Created
February 11, 2014 09:39
-
-
Save jaimeagudo/8931879 to your computer and use it in GitHub Desktop.
Custom cookie for Friend middleware
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
(defn friend-middleware | |
"Returns a middleware that enables authentication via Friend." | |
[handler] | |
(let [auth-config { | |
:credential-fn (partial creds/bcrypt-credential-fn db/load-credentials) | |
:redirect-on-auth? false | |
:logout-uri "/logout" | |
:signup-uri "/registration" | |
:workflows | |
[;; Note that ordering matters here. Basic first. | |
(workflows/interactive-form) | |
]}] | |
(-> handler | |
(friend/authenticate auth-config) | |
(wrap-session {:cookie-attrs {:max-age 3600} :cookie-name "my-site.com" } ) | |
))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment