Adds grpc interceptor

How can I use grpc Server Interceptor with Akka grpc?

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.

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

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

1 Like

There’s no example specifically about JWT, but I recently opened a PR with an example of integrating ‘regular’ Akka HTTP routes and directives with an Akka gRPC service. You can find this at https://github.com/akka/akka-grpc/pull/544/files. That might give some good input to get started?

1 Like

This now also has a page in the documentation, Akka HTTP interop • Akka gRPC