Class AbstractAuthenticatingServerCallListener<ReqT>

java.lang.Object
io.grpc.ServerCall.Listener<ReqT>
io.grpc.ForwardingServerCallListener<ReqT>
io.grpc.ForwardingServerCallListener.SimpleForwardingServerCallListener<ReqT>
net.devh.boot.grpc.server.security.interceptors.AbstractAuthenticatingServerCallListener<ReqT>
Type Parameters:
ReqT - The type of the request.

public abstract class AbstractAuthenticatingServerCallListener<ReqT> extends ForwardingServerCallListener.SimpleForwardingServerCallListener<ReqT>
A call listener that will set the authentication context before each invocation and clear it afterwards. Use and extend this class if you want to setup non-grpc authentication contexts.

Note: If you only want to setup the grpc-context and nothing else, then you can use Contexts.interceptCall(Context, ServerCall, Metadata, ServerCallHandler) instead.

  • Constructor Details

    • AbstractAuthenticatingServerCallListener

      protected AbstractAuthenticatingServerCallListener(ServerCall.Listener<ReqT> delegate, Context context)
      Creates a new AbstractAuthenticatingServerCallListener which will attach the given security context before delegating to the given listener.
      Parameters:
      delegate - The listener to delegate to.
      context - The context to attach.
  • Method Details

    • context

      protected final Context context()
      Gets the Context associated with the call.
      Returns:
      The context of the current call.
    • attachAuthenticationContext

      protected abstract void attachAuthenticationContext()
      Attaches the authentication context before the actual call.

      This method is called after the grpc context is attached.

    • detachAuthenticationContext

      protected abstract void detachAuthenticationContext()
      Detaches the authentication context after the actual call.

      This method is called before the grpc context is detached.

    • onMessage

      public void onMessage(ReqT message)
      Overrides:
      onMessage in class ForwardingServerCallListener<ReqT>
    • onHalfClose

      public void onHalfClose()
    • onCancel

      public void onCancel()
    • onComplete

      public void onComplete()
    • onReady

      public void onReady()
    • toString

      public String toString()
      Overrides:
      toString in class Object