Skip to content

Commit

Permalink
fixes #3 (last commit didn't actually do it!) pulls login-uri from au…
Browse files Browse the repository at this point in the history
…th-conf assoc'ed into request. This commit also updates a good number of dependencies and sets some exclusions after running through lein-pedantic.
  • Loading branch information
ddellacosta committed Mar 31, 2013
1 parent 64d91f0 commit 6feda66
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
10 changes: 5 additions & 5 deletions project.clj
Expand Up @@ -4,14 +4,14 @@
:license {:name "MIT License" :license {:name "MIT License"
:url "http://dd.mit-license.org"} :url "http://dd.mit-license.org"}
:dependencies [[org.clojure/clojure "1.4.0"] :dependencies [[org.clojure/clojure "1.4.0"]
[com.cemerick/friend "0.1.4"] [com.cemerick/friend "0.1.5" :exclusions [ring/ring-core]]
[ring "1.1.8"] [ring "1.2.0-beta2"]
[clj-http "0.6.5"] [ring/ring-codec "1.0.0"]
[clj-http "0.6.5" :exclusions [org.apache.httpcomponents/httpclient slingshot]]
[cheshire "5.0.2"]] [cheshire "5.0.2"]]
:plugins [[lein-ring "0.8.3"] :plugins [[lein-ring "0.8.3"]
[lein-midje "3.0.0"] [lein-midje "3.0.0"]
[codox "0.6.4"]] [codox "0.6.4"]]
:profiles :profiles
{:dev {:dependencies [[ring-mock "0.1.3"] {:dev {:dependencies [[ring-mock "0.1.3"]
[ring "1.2.0-beta2"] [midje "1.5.0" :exclusions [org.clojure/core.incubator joda-time]]]}})
[midje "1.5.0"]]}})
7 changes: 4 additions & 3 deletions src/friend_oauth2/workflow.clj
@@ -1,7 +1,7 @@
(ns friend-oauth2.workflow (ns friend-oauth2.workflow
(:require [cemerick.friend :as friend] (:require [cemerick.friend :as friend]
[clj-http.client :as client] [clj-http.client :as client]
[ring.util.codec :as codec] [ring.util.codec :as ring-codec]
[ring.util.request :as ring-request] [ring.util.request :as ring-request]
[cheshire.core :as j])) [cheshire.core :as j]))


Expand All @@ -16,7 +16,7 @@
"Formats the client authentication uri" "Formats the client authentication uri"
[{:keys [authentication-uri]}] [{:keys [authentication-uri]}]
(str (authentication-uri :url) "?" (str (authentication-uri :url) "?"
(codec/form-encode (authentication-uri :query)))) (ring-codec/form-encode (authentication-uri :query))))


(defn replace-authorization-code (defn replace-authorization-code
"Formats the token uri with the authorization code" "Formats the token uri with the authorization code"
Expand All @@ -43,12 +43,13 @@
"Workflow for OAuth2" "Workflow for OAuth2"
[config] [config]
(fn [request] (fn [request]

;; If we have a callback for this workflow ;; If we have a callback for this workflow
;; or a login URL in the request, process it. ;; or a login URL in the request, process it.
(if (or (= (ring-request/path-info request) (if (or (= (ring-request/path-info request)
(-> config :client-config :callback :path)) (-> config :client-config :callback :path))
(= (ring-request/path-info request) (= (ring-request/path-info request)
(config :login-uri))) (or (:login-uri config) (:login-uri (::friend/auth-config request)))))


;; Steps 2 and 3: ;; Steps 2 and 3:
;; accept auth code callback, get access_token (via POST) ;; accept auth code callback, get access_token (via POST)
Expand Down

0 comments on commit 6feda66

Please sign in to comment.