[gRPC C#] Populate AuthContext on server, based on JWT Authentication

48 views
Skip to first unread message

Ivan Penchev

unread,
Oct 24, 2018, 3:34:29 AM10/24/18
to grpc.io
Cross-post from Here

Clients: Java(Android)/Swift(iOS)

Use case:

On client -- All chanels are SSL protected, and we have a DB that stores our "token", which we call and send on reqests

On server -- We get JWT token in RequestHeaders, we validate it, if its valid Time,Issuer and Audience we populate the AuthContext, by coverting the ClaimsPrincipal I get out of the JWT token.

Problem:

AuthContext is internal and I cant populate it in my Interceptor?

Questions:
1. Can you populate the AuthContext somehow from a interceptor?
2. If you cant populate the AuthContext, how can I pass the useful information from the JWT to my RPC Method? (inital idea was to populate extra RequestHeaders, is that a good idea?)

Code example of my interceptor, can be found Here

Jan Tattermusch

unread,
Nov 12, 2018, 12:11:10 PM11/12/18
to grpc.io
Reply all
Reply to author
Forward
0 new messages