Class GrpcMessageInterceptor

  • All Implemented Interfaces:
    io.grpc.ServerInterceptor

    @Component
    public class GrpcMessageInterceptor
    extends Object
    implements io.grpc.ServerInterceptor
    GrpcMessageInterceptor intercepts a GRPC calls to log handling of GRPC messages to the Audit Log. Intercepts the incoming and outgoing messages logs them to the audit log, together with method name and assumed authenticated identity (if authentication is enabled). NOTE: GrpcMessageInterceptor assumes that all service calls are unary (ie single request/response).
    • Constructor Detail

      • GrpcMessageInterceptor

        @Autowired
        public GrpcMessageInterceptor​(LoggingProperties loggingProperties,
                                      @Nullable
                                      SecurityProperties securityProperties)
        Construct GrpcMessageIntercetor.
        Parameters:
        loggingProperties - properties used to configure logging interceptor.
        securityProperties - If provided, will output the subject claim specified in securityProperties as identity in MessageAuditLogEntry instead.
    • Method Detail

      • interceptCall

        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)
        Specified by:
        interceptCall in interface io.grpc.ServerInterceptor