Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes #3 (last commit didn't actually do it!) pulls login-uri from au…

…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...
commit 6feda6696199b7b64f5d866dff7045584f16a442 1 parent 64d91f0
@ddellacosta authored
Showing with 9 additions and 8 deletions.
  1. +5 −5 project.clj
  2. +4 −3 src/friend_oauth2/workflow.clj
View
10 project.clj
@@ -4,14 +4,14 @@
:license {:name "MIT License"
:url "http://dd.mit-license.org"}
:dependencies [[org.clojure/clojure "1.4.0"]
- [com.cemerick/friend "0.1.4"]
- [ring "1.1.8"]
- [clj-http "0.6.5"]
+ [com.cemerick/friend "0.1.5" :exclusions [ring/ring-core]]
+ [ring "1.2.0-beta2"]
+ [ring/ring-codec "1.0.0"]
+ [clj-http "0.6.5" :exclusions [org.apache.httpcomponents/httpclient slingshot]]
[cheshire "5.0.2"]]
:plugins [[lein-ring "0.8.3"]
[lein-midje "3.0.0"]
[codox "0.6.4"]]
:profiles
{:dev {:dependencies [[ring-mock "0.1.3"]
- [ring "1.2.0-beta2"]
- [midje "1.5.0"]]}})
+ [midje "1.5.0" :exclusions [org.clojure/core.incubator joda-time]]]}})
View
7 src/friend_oauth2/workflow.clj
@@ -1,7 +1,7 @@
(ns friend-oauth2.workflow
(:require [cemerick.friend :as friend]
[clj-http.client :as client]
- [ring.util.codec :as codec]
+ [ring.util.codec :as ring-codec]
[ring.util.request :as ring-request]
[cheshire.core :as j]))
@@ -16,7 +16,7 @@
"Formats the client authentication uri"
[{:keys [authentication-uri]}]
(str (authentication-uri :url) "?"
- (codec/form-encode (authentication-uri :query))))
+ (ring-codec/form-encode (authentication-uri :query))))
(defn replace-authorization-code
"Formats the token uri with the authorization code"
@@ -43,12 +43,13 @@
"Workflow for OAuth2"
[config]
(fn [request]
+
;; If we have a callback for this workflow
;; or a login URL in the request, process it.
(if (or (= (ring-request/path-info request)
(-> config :client-config :callback :path))
(= (ring-request/path-info request)
- (config :login-uri)))
+ (or (:login-uri config) (:login-uri (::friend/auth-config request)))))
;; Steps 2 and 3:
;; accept auth code callback, get access_token (via POST)
Please sign in to comment.
Something went wrong with that request. Please try again.