Adds grpc interceptor

akka-http
akka

(Amir) #1

How can I use grpc Server Interceptor with Akka grpc?


(Johan Andrén) #2

The ServerInterceptor is a concept from the grpc-java server, which is a different grpc implementation than the Akka gRPC server, so there is no way to use it.

You can do some of the things a ServerInterceptor can do through wrapping the function returned by the NnnHandlerFactory.create and other aspects through regular composition. We don’t have any samples for either though.


(Amir) #3

How can I read headers? I want to implements JWT authentication, is there any example about it?


(Johan Andrén) #4

There’s no examples available for that, yet.

The request headers can be accessed from the Akka HTTP Request that you can intercept by wrapping the function you pass to the create-method. There is also work in progress on a power-api on the server side giving access to metadata, in this PR https://github.com/akka/akka-grpc/pull/429