You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
what does this line do? grpc_ctxtags.Extract(ctx).Set("auth.sub", userClaimFromToken(tokenInfo))
also // WARNING: in production define your own type to avoid context collisions - do you suggest to define custom context type? but why? as i know it is a bad practice
The text was updated successfully, but these errors were encountered:
This if you want further interceptors OR gRPC service code to use certain information about that token (e.g often it's needed to communicate with downstream services or so). From interceptor the only "request" state is through context, thus you need to create your own context key in some form. What exactly is bad practice? If you mean using context keys - I agree, but there is nothing better to put some state to the context.
Using v2, if the auth interceptor is added after the logging interceptor, no auth.sub is available in the default grpc server logs.
When adding auth first, no logs will show if the auth function fails.
Wouldn't it make sense if PostCall somehow had access to the context of previous handlers/middlewares?
Hello, checking auth middleware example (https://github.com/grpc-ecosystem/go-grpc-middleware/tree/master/auth#L36) and have several questions:
grpc_ctxtags.Extract(ctx).Set("auth.sub", userClaimFromToken(tokenInfo))
// WARNING: in production define your own type to avoid context collisions
- do you suggest to define custom context type? but why? as i know it is a bad practiceThe text was updated successfully, but these errors were encountered: