Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

default-unauthenticated-handler retains query-string on unauthorized-uri #70

Merged
merged 1 commit into from

2 participants

@abp

Fixes #68, extends the test to account for query-strings.

I've used util/original-url, to account for #42 too.

Sorry for changes in whitespace, my emacs is set to clean those automatically.

@cemerick
Owner

Good catch, thanks! Could you update the PR without the whitespace changes?

@abp abp Fixes #68
Preserve query-string on ::unauthorized-uri and store an absolute url.
Also test for absolute url and query-string present in redirect-location
after login.
dc6de69
@abp

Done!

@cemerick cemerick merged commit 5f0c39d into cemerick:master

1 check passed

Details default The Travis CI build passed
@abp abp deleted the abp:unauthenticated-handler-fix branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 16, 2013
  1. @abp

    Fixes #68

    abp authored
    Preserve query-string on ::unauthorized-uri and store an absolute url.
    Also test for absolute url and query-string present in redirect-location
    after login.
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +1 −1  src/cemerick/friend.clj
  2. +2 −2 test/test_friend/functional.clj
View
2  src/cemerick/friend.clj
@@ -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."
View
4 test/test_friend/functional.clj
@@ -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}))))
Something went wrong with that request. Please try again.