Created
March 17, 2014 09:08
-
-
Save iperdomo/9596103 to your computer and use it in GitHub Desktop.
Proposal to make `:redirect-on-auth?` dynamic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/cemerick/friend.clj b/src/cemerick/friend.clj | |
index 0c8dda5..0731a64 100644 | |
--- a/src/cemerick/friend.clj | |
+++ b/src/cemerick/friend.clj | |
@@ -154,6 +154,7 @@ Equivalent to (complement current-authentication)."} | |
resp (response/redirect-after-post | |
(or unauthorized-uri | |
(and (string? redirect) redirect) | |
+ (and (fn? redirect) (redirect authentication-map request)) | |
(str (:context request) (-> request ::auth-config :default-landing-uri ))))] | |
(if unauthorized-uri | |
(-> resp |
The redirect
value you're proposing checking to be a function or not is not coming from the configuration to friend/authenticate
; it's a value that is attached to the authentication map's metadata, as returned by your workflow.
You can achieve what you want now by modifying the responses of the workflow(s) you use to add in the user's home URL as the :cemerick.friend/redirect
in the authentication map's metadata.
That said, providing a way to dynamically control redirects without providing custom or wrapped workflows would make things easier (and simpler, if multiple workflows are in play). Please file an issue, but the proposed change here is not correct.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
authentication-map
andrequest
and returns a string with the redirect path