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
I'm working on interceptors to validate scopes in auth tokens for endpoints. We have proto options defined on the endpoints which specify valid scopes. I need to reflect over the descriptors to get access to the options.
However, the only way to walk the schema of the services defined in a server is via a *grpc.Server. The *grpc.Server is not passed into the interceptor and the descriptors (ServiceDescriptor / MethodDescriptor/ ....) are not available in the interceptors either.
I cannot initialise an interceptor with a server because it needs to be passed into the server as an option. The server has no lifecycle hooks that would let the interceptors be lazily registered before startup. There is a clunky workaround to this:
inter:=&interceptor{}
srv:=grpc.NewServer(grpc.UnaryInterceptor(inter))
inter.server=srv// <-- eventually use this to lazy load the schema from the server on first use
Would it be possible to have one of the following:
Have lifecycle hooks to register interceptors before Serve() --i.e., func(s *grpc.Server) []grpc.ServerOption ?
Have access to the relevant descriptors in the interceptors.
Have access to the server object in the interceptors.
The text was updated successfully, but these errors were encountered:
I'm working on interceptors to validate scopes in auth tokens for endpoints. We have proto options defined on the endpoints which specify valid scopes. I need to reflect over the descriptors to get access to the options.
However, the only way to walk the schema of the services defined in a server is via a
*grpc.Server
. The*grpc.Server
is not passed into the interceptor and the descriptors (ServiceDescriptor
/MethodDescriptor
/ ....) are not available in the interceptors either.I cannot initialise an interceptor with a server because it needs to be passed into the server as an option. The server has no lifecycle hooks that would let the interceptors be lazily registered before startup. There is a clunky workaround to this:
Would it be possible to have one of the following:
Serve()
--i.e.,func(s *grpc.Server) []grpc.ServerOption
?The text was updated successfully, but these errors were encountered: