Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 776de46a0c11394fa823540d1108e5c1d4c7104d 1 parent 52a5aee
@cemerick authored
View
2  project.clj
@@ -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
1  src/cemerick/friend.clj
@@ -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))
View
7 src/cemerick/friend/workflows.clj
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.