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 have stumbled upon a situation where I need to verify a signature of an incoming request based on its body. I thought request guards would be the perfect solution for this, but when I started implementing the FromRequest trait, I noticed the request parameter of the trait function doesn't actually provide any way to access the body of the request. Now I am a bit stuck.
Is there any other option I can use to get access to the request body in the request guard, or should I be using a different mechanism altogether for this?
I know I can get a request body in a POST route with the Data struct, but I would rather not handle the entire business logic inside of the API controller itself,. Especially since in the route itself access to things like headers is also difficult. There just doesn't seem to be any optimal way to do this with my current knowledge and I can't find it documented anywhere.
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
-
Hi,
I have stumbled upon a situation where I need to verify a signature of an incoming request based on its body. I thought request guards would be the perfect solution for this, but when I started implementing the
FromRequest
trait, I noticed therequest
parameter of the trait function doesn't actually provide any way to access the body of the request. Now I am a bit stuck.Is there any other option I can use to get access to the request body in the request guard, or should I be using a different mechanism altogether for this?
I know I can get a request body in a POST route with the
Data
struct, but I would rather not handle the entire business logic inside of the API controller itself,. Especially since in the route itself access to things like headers is also difficult. There just doesn't seem to be any optimal way to do this with my current knowledge and I can't find it documented anywhere.Thank you!
Beta Was this translation helpful? Give feedback.
All reactions