@GrpcGlobalServerInterceptor @Order(value=5000) public class ExceptionTranslatingServerInterceptor extends Object implements io.grpc.ServerInterceptor
AuthenticationException and AccessDeniedException to
appropriate grpc status responses.| Modifier and Type | Field and Description |
|---|---|
static String |
ACCESS_DENIED_DESCRIPTION
A constant that contains the response message for calls with insufficient permissions.
|
static String |
UNAUTHENTICATED_DESCRIPTION
A constant that contains the response message for unauthenticated calls.
|
| Constructor and Description |
|---|
ExceptionTranslatingServerInterceptor() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeCallAccessDenied(io.grpc.ServerCall<?,?> call,
AccessDeniedException aex)
Close the call with
Status.PERMISSION_DENIED. |
protected void |
closeCallUnauthenticated(io.grpc.ServerCall<?,?> call,
AuthenticationException aex)
Close the call with
Status.UNAUTHENTICATED. |
<ReqT,RespT> |
interceptCall(io.grpc.ServerCall<ReqT,RespT> call,
io.grpc.Metadata headers,
io.grpc.ServerCallHandler<ReqT,RespT> next) |
protected <ReqT> io.grpc.ServerCall.Listener<ReqT> |
noOpCallListener()
Creates a new no-op call listener because you can neither return null nor throw an exception in
interceptCall(ServerCall, Metadata, ServerCallHandler). |
public static final String UNAUTHENTICATED_DESCRIPTION
public static final String ACCESS_DENIED_DESCRIPTION
public ExceptionTranslatingServerInterceptor()
public <ReqT,RespT> io.grpc.ServerCall.Listener<ReqT> interceptCall(io.grpc.ServerCall<ReqT,RespT> call,
io.grpc.Metadata headers,
io.grpc.ServerCallHandler<ReqT,RespT> next)
interceptCall in interface io.grpc.ServerInterceptorprotected <ReqT> io.grpc.ServerCall.Listener<ReqT> noOpCallListener()
interceptCall(ServerCall, Metadata, ServerCallHandler).ReqT - The type of the request.protected void closeCallUnauthenticated(io.grpc.ServerCall<?,?> call,
AuthenticationException aex)
Status.UNAUTHENTICATED.call - The call to close.aex - The exception that was the cause.protected void closeCallAccessDenied(io.grpc.ServerCall<?,?> call,
AccessDeniedException aex)
Status.PERMISSION_DENIED.call - The call to close.aex - The exception that was the cause.