MCPcopy Create free account
hub / github.com/grpc/grpc-java / interceptCall

Method interceptCall

xds/src/main/java/io/grpc/xds/RbacFilter.java:192–208  ·  view source on GitHub ↗
(
                final ServerCall<ReqT, RespT> call,
                final Metadata headers, ServerCallHandler<ReqT, RespT> next)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

decisionMethod · 0.95
matchingPolicyNameMethod · 0.95
withDescriptionMethod · 0.80
isLoggableMethod · 0.65
closeMethod · 0.65
startCallMethod · 0.65
evaluateMethod · 0.45
logMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected