eclipse-vertx / vertx-grpc

Development of the gRPC component for Eclipse Vert.x
Eclipse Public License 2.0
42 stars 23 forks source link

Add JWT support for gRPC server #75

Open Jotschi opened 11 months ago

Jotschi commented 11 months ago

Motivation:

This PR adds JWT support to the GrpcServer.

TODO:

vietj commented 11 months ago

Shouldn't we set an auth handler when we do register a handler instead of being global to the server ?

Jotschi commented 11 months ago

Shouldn't we set an auth handler when we do register a handler instead of being global to the server ?

Right. That would be better. I changed the API.

Jotschi commented 11 months ago

@vietj I have squashed the commits of this PR and cherry-picked it into 4.x / 4.4 because I need this feature for my Vert.x 4.4.x project. This is just a headsup to let you know that this PR would also work for 4.x

vietj commented 11 months ago

can we also expect Oauth2 support and client support ?

Jotschi commented 11 months ago

can we also expect Oauth2 support and client support ?

I added token credential support to the client. As for Oauth2 support I don't feel comfortable to add it at this stage.

vietj commented 10 months ago

can you describe the issue for oauth2 ? it seems pretty ok to me, but pehraps I'm missing something

Jotschi commented 10 months ago

@vietj I took a look at the existing webclient implementation https://github.com/vert-x3/vertx-web/blob/master/vertx-web-client/src/main/java/io/vertx/ext/web/client/impl/OAuth2AwareInterceptor.java I assume it would need to work in a similar way and basically intercept the calls and check whether the token needs to be refreshed. For this PR I would like to focus on JWT. Adding OAuth2 would mean creating an additional maven module. (eg. oauth2-grpc-client). I'm however getting a bit time constrained at the moment and can't add it at this point of time.