This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
I've a question on routing interceptors. I'm using sieppari
. I want to handle auth by routing a request back to /login
if user is not logged in. Would I use a routing interceptor here? If not, what would you recommend?
in general, how is rerouting accomplished?
Should I simply have an interceptor that modifies a handler if auth fails?
The following works, but is this what you'd recommend
(if-not logged-in?
(assoc ctx :queue
(conj clojure.lang.PersistentQueue/EMPTY
(into-interceptor unauthorized-handler))))
I guess I could also get the handler I want by querying the router by name
What I really want is for an interceptor to pre-empt a response and not take the request all the way to the handler. Still wondering how this is done.
I've looked at the examples, but not found one
@srijayanth i guess https://github.com/metosin/sieppari/blob/develop/src/sieppari/context.cljc#L26 would do it? adding something like (s/terminate {:status 403, :body "You shall not pass here!"})
as the response in your interceptor may just do it?
I thought so too
Which is Pedestal's
I'll check it out
doesnt look like the one released on clojars has this fn
Seems to
right
maybe i guess add the body of the terminate to your handler
Actually, I have no idea if it is on clojars. In fact, I've not directly added sieppari
as a dependency. Just depending on What reitit has
Anyway, it does work, and it is exactly what I want. Thanks
nice! i guess sieppari the repo, could be behind
Worked! Thanks a ton. I was poking around in the executor