Skip to content

Instantly share code, notes, and snippets.

@jaimeagudo
Created February 11, 2014 09:39
Show Gist options
  • Save jaimeagudo/8931879 to your computer and use it in GitHub Desktop.
Save jaimeagudo/8931879 to your computer and use it in GitHub Desktop.
Custom cookie for Friend middleware
(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