Permalink
Browse files

Merge pull request #70 from abp/unauthenticated-handler-fix

Retain full unauthorized URL (including parameters, etc) on redirect
  • Loading branch information...
2 parents 712b91b + dc6de69 commit 5f0c39dda476b5fc71268042980cf6368b6badcd @cemerick committed Aug 16, 2013
Showing with 3 additions and 3 deletions.
  1. +1 −1 src/cemerick/friend.clj
  2. +2 −2 test/test_friend/functional.clj
View
@@ -162,7 +162,7 @@ Equivalent to (complement current-authentication)."}
(util/resolve-absolute-uri request)
ring.util.response/redirect
(assoc :session (:session request))
- (assoc-in [:session ::unauthorized-uri] (:uri request))))
+ (assoc-in [:session ::unauthorized-uri] (util/original-url request))))
(defn authenticate-response
"Adds to the response's :session for responses with a :friend/ensure-identity-request key."
@@ -62,14 +62,14 @@
(deftest user-login
(binding [clj-http.core/*cookie-store* (clj-http.cookies/cookie-store)]
- (is (= (page-bodies "/login") (:body (http/get (url "/user/account")))))
+ (is (= (page-bodies "/login") (:body (http/get (url "/user/account?query-string=test")))))
(let [resp (http/post (url "/login")
{:form-params {:username "jane" :password "user_password"}})]
; ensure that previously-requested page is redirected to upon redirecting authentication
; clj-http *should* redirect us, but isn't yet; working on it:
; https://github.com/dakrone/clj-http/issues/57
(is (http/redirect? resp))
- (is (= "/user/account" (-> resp :headers (get "location")))))
+ (is (= (url "/user/account?query-string=test") (-> resp :headers (get "location")))))
(check-user-role-access)
(is (= {:roles ["test-friend.mock-app/user"]} (:body (http/get (url "/echo-roles") {:as :json}))))

0 comments on commit 5f0c39d

Please sign in to comment.