From ae0f1d537a5a2d5396672fb149004742a7e5710d Mon Sep 17 00:00:00 2001 From: Chetan Padia Date: Sat, 16 May 2015 22:02:21 +0100 Subject: [PATCH 1/3] allow redirect-uri with no query parameters in ring wrapper --- src/clj_oauth2/ring.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clj_oauth2/ring.clj b/src/clj_oauth2/ring.clj index fa4139f..12377ad 100644 --- a/src/clj_oauth2/ring.clj +++ b/src/clj_oauth2/ring.clj @@ -115,7 +115,7 @@ create a vector of values." "Returns true if this is a request to the callback URL" (let [oauth2-url-vector (string/split (.toString (java.net.URI. (:redirect-uri oauth2-params))) #"\?") oauth2-uri (nth oauth2-url-vector 0) - oauth2-url-params (nth oauth2-url-vector 1) + oauth2-url-params (or (get oauth2-url-vector 1) "") encoding (or (:character-encoding request) "UTF-8")] (and (= oauth2-uri (request-uri request oauth2-params)) (submap? (keyify-params (parse-params oauth2-url-params encoding)) (:params request))))) From 3dabd568d65e2d11c890db2114e6ee9011430332 Mon Sep 17 00:00:00 2001 From: Chetan Padia Date: Sat, 16 May 2015 22:05:20 +0100 Subject: [PATCH 2/3] allow for string paramters from ring wrap-params --- src/clj_oauth2/ring.clj | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/clj_oauth2/ring.clj b/src/clj_oauth2/ring.clj index 12377ad..459d9f2 100644 --- a/src/clj_oauth2/ring.clj +++ b/src/clj_oauth2/ring.clj @@ -118,7 +118,8 @@ create a vector of values." oauth2-url-params (or (get oauth2-url-vector 1) "") encoding (or (:character-encoding request) "UTF-8")] (and (= oauth2-uri (request-uri request oauth2-params)) - (submap? (keyify-params (parse-params oauth2-url-params encoding)) (:params request))))) + (submap? (keyify-params (parse-params oauth2-url-params encoding)) + (keyify-params (:params request)))))) ;; This Ring wrapper acts as a filter, ensuring that the user has an OAuth ;; token for all but a set of explicitly excluded URLs. The response from @@ -136,11 +137,11 @@ create a vector of values." ;; it in the response and redirect to the originally requested URL (let [response {:status 302 :headers {"Location" ((:get-target oauth2-params) request)}} - oauth2-data (oauth2/get-access-token - oauth2-params - (:params request) - (oauth2/make-auth-request - oauth2-params + oauth2-data (oauth2/get-access-token + oauth2-params + (keyify-params (:params request)) + (oauth2/make-auth-request + oauth2-params ((:get-state oauth2-params) request)))] ((:put-oauth2-data oauth2-params) request response oauth2-data)) ;; We're not handling the callback From 1349876c3e3f32522194c9c094fc8ad3112ac58c Mon Sep 17 00:00:00 2001 From: Chetan Padia Date: Sat, 16 May 2015 22:05:53 +0100 Subject: [PATCH 3/3] bump version to 0.3.1 --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index 1227c19..dea5bae 100644 --- a/project.clj +++ b/project.clj @@ -1,7 +1,7 @@ (def dev-dependencies '[[ring "0.3.11"]]) -(defproject clj-oauth2 "0.3.0" +(defproject clj-oauth2 "0.3.1" :description "clj-http and ring middlewares for OAuth 2.0" :dependencies [[org.clojure/clojure "1.3.0"] [org.clojure/data.json "0.1.1"]