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
intercept request: validate jwt from authorization header, extract claims and embed in extension
inner.call: grpc handler should perform authorization and save result into extension
intercept response: check extension for authorization result. if it's missing, return internal server error.
The idea is to ensure that authorization is run on every grpc method.
But how can I return a new Ok(Response) or an Err(...) inside call()?
The types are confusing to me. I think the return is Result<hyper::Response>,tower_service::Service::Error> ?
How do I build each of these types? And what is more correct? new response with status 500, or an Err?
I'd like an example of both if possible.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using the tower example:
I'm trying to:
The idea is to ensure that authorization is run on every grpc method.
But how can I return a new Ok(Response) or an Err(...) inside call()?
The types are confusing to me. I think the return is Result<hyper::Response>,tower_service::Service::Error> ?
How do I build each of these types? And what is more correct? new response with status 500, or an Err?
I'd like an example of both if possible.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions