Permalink
Browse files

Respect :context in Ring requests in interactive-form workflow + defa…

…ult-unauthenticated-handler, fixes gh-52

* now requires ring 1.2.0-beta1
  • Loading branch information...
1 parent 52a5aee commit 776de46a0c11394fa823540d1108e5c1d4c7104d @cemerick committed Mar 14, 2013
Showing with 6 additions and 4 deletions.
  1. +1 −1 project.clj
  2. +1 −0 src/cemerick/friend.clj
  3. +4 −3 src/cemerick/friend/workflows.clj
View
@@ -5,7 +5,7 @@
:url "http://www.eclipse.org/legal/epl-v10.html"}
:min-lein-version "2.0.0"
:dependencies [[org.clojure/clojure "1.4.0"]
- [ring/ring-core "1.1.0"]
+ [ring/ring-core "1.2.0-beta1"]
[slingshot "0.10.2"]
[robert/hooke "1.1.2"]
[org.clojure/core.incubator "0.1.1"]
View
@@ -158,6 +158,7 @@ Equivalent to (complement current-authentication)."}
(-> request
::auth-config
:login-uri
+ (#(str (:context request) %))
(util/resolve-absolute-uri request)
ring.util.response/redirect
(assoc :session (:session request))
@@ -1,6 +1,7 @@
(ns cemerick.friend.workflows
(:require [cemerick.friend :as friend]
- [cemerick.friend.util :as util])
+ [cemerick.friend.util :as util]
+ [ring.util.request :as req])
(:use [clojure.string :only (trim)]
[cemerick.friend.util :only (gets)])
(:import org.apache.commons.codec.binary.Base64))
@@ -70,8 +71,8 @@
(defn interactive-form
[& {:keys [login-uri credential-fn login-failure-handler redirect-on-auth?] :as form-config
:or {redirect-on-auth? true}}]
- (fn [{:keys [uri request-method params] :as request}]
- (when (and (= (gets :login-uri form-config (::friend/auth-config request)) uri)
+ (fn [{:keys [request-method params] :as request}]
+ (when (and (= (gets :login-uri form-config (::friend/auth-config request)) (req/path-info request))
(= :post request-method))
(let [{:keys [username password] :as creds} (select-keys params [:username :password])]
(if-let [user-record (and username password

0 comments on commit 776de46

Please sign in to comment.