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 am setting data in a httpOnly cookie, this means that the javascript cannot directly interact with it, but on each request it is sent to the backend.
The content of the cookie is used for authorization purposes. Now I can include logic in every handler to extract the content of the cookie but I thought that will be tedious.
So I was thinking to extract the logic to get the cookie value and perform the authorization logic in a middleware. But unfortunately I have not been able to find out.
The closes I found is based off using actix_session but that does not fit my bill because it will still involve injecting Session into every handler, and then perform the authorization checks. I'll the handlers don't contain this logic and hence why i will love to put it in a middleware.
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 am setting data in a httpOnly cookie, this means that the javascript cannot directly interact with it, but on each request it is sent to the backend.
The content of the cookie is used for authorization purposes. Now I can include logic in every handler to extract the content of the cookie but I thought that will be tedious.
So I was thinking to extract the logic to get the cookie value and perform the authorization logic in a middleware. But unfortunately I have not been able to find out.
The closes I found is based off using
actix_session
but that does not fit my bill because it will still involve injectingSession
into every handler, and then perform the authorization checks. I'll the handlers don't contain this logic and hence why i will love to put it in a middleware.Any ideas on how to go about this?
Beta Was this translation helpful? Give feedback.
All reactions