Fork me on GitHub
#aleph
<
2019-04-26
>
jmromrell16:04:32

Can I rely on a manifold stream as a response to a web request to behave as a delay (meaning no execution of its content until it is realized after being handled by middleware)?

jmromrell16:04:06

I'm wanting to write auth middleware which relies on this property and enforces authentication/authorization after the response is being passed back up the middleware chain, rather than checking auth before the handler is reached.

jmromrell16:04:10

I have been running into issues with compojure where if I try to handle auth in middleware as the request is coming in, it will end up enforcing auth even if the request didn't match any of the routes I was trying to implement auth for.

valerauko07:04:07

This could be resolved by using #reitit instead which has per-route middleware

jmromrell16:04:17

But if I delay checking auth until after a handler returns something (so I know a route was matched), then the handler has already executed the contents regardless of if the user were authenticated/authorized.