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.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.grpc.ForwardingServerCallListener
ForwardingServerCallListener.SimpleForwardingServerCallListener<ReqT extends Object> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractAuthenticatingServerCallListener(ServerCall.Listener<ReqT> delegate, Context context) Creates a new AbstractAuthenticatingServerCallListener which will attach the given security context before delegating to the given listener. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidAttaches the authentication context before the actual call.protected final Contextcontext()Gets theContextassociated with the call.protected abstract voidDetaches the authentication context after the actual call.voidonCancel()voidvoidvoidvoidonReady()toString()Methods inherited from class io.grpc.ForwardingServerCallListener.SimpleForwardingServerCallListener
delegate
-
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
Gets theContextassociated 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
- Overrides:
onMessagein classForwardingServerCallListener<ReqT>
-
onHalfClose
public void onHalfClose() -
onCancel
public void onCancel() -
onComplete
public void onComplete() -
onReady
public void onReady() -
toString
-