(
final ServerCall<ReqT, RespT> call,
final Metadata headers, ServerCallHandler<ReqT, RespT> next)
| 190 | final GrpcAuthorizationEngine authEngine = new GrpcAuthorizationEngine(config); |
| 191 | return new ServerInterceptor() { |
| 192 | @Override |
| 193 | public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall( |
| 194 | final ServerCall<ReqT, RespT> call, |
| 195 | final Metadata headers, ServerCallHandler<ReqT, RespT> next) { |
| 196 | AuthDecision authResult = authEngine.evaluate(headers, call); |
| 197 | if (logger.isLoggable(Level.FINE)) { |
| 198 | logger.log(Level.FINE, |
| 199 | "Authorization result for serverCall {0}: {1}, matching policy: {2}.", |
| 200 | new Object[]{call, authResult.decision(), authResult.matchingPolicyName()}); |
| 201 | } |
| 202 | if (GrpcAuthorizationEngine.Action.DENY.equals(authResult.decision())) { |
| 203 | Status status = Status.PERMISSION_DENIED.withDescription("Access Denied"); |
| 204 | call.close(status, new Metadata()); |
| 205 | return new ServerCall.Listener<ReqT>(){}; |
| 206 | } |
| 207 | return next.startCall(call, headers); |
| 208 | } |
| 209 | }; |
| 210 | } |
| 211 |
nothing calls this directly
no test coverage detected