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 a middleware that will authenticate the request - is there any way for me to mount this middleware only on those routes that require auhentication (ie, at some stage in the route-matching process) or would I have to do it using an actionM rather than a middleware and manually call it on every single authenticated route?
The text was updated successfully, but these errors were encountered:
My initial thought was "absolutely no way I still have any clue what's going on", but I did some digging and I actually managed to find the original code, which is wild to me given this was 8 years ago.
Originally:
authenticate::Context->Middleware
authenticate ctx app req respond =-- TODO: Looks like Scotty doesn't support middleware only on certain routes :/if pathInfo req == ["tokens"] then passthrough elsecase getBearerToken $ requestHeaders req ofLeft _ -> respond authenticationError
Right token ->do
valid <- validate ctx token
if valid then passthrough else respond authenticationError
where passthrough = app req respond
blast from the past. thanks for the hit of nostalgia!
I have a middleware that will authenticate the request - is there any way for me to mount this middleware only on those routes that require auhentication (ie, at some stage in the route-matching process) or would I have to do it using an
actionM
rather than a middleware and manually call it on every single authenticated route?The text was updated successfully, but these errors were encountered: