Skip to content

Commit

Permalink
Properly load authorization token
Browse files Browse the repository at this point in the history
  • Loading branch information
pelle committed Sep 19, 2013
1 parent 4ff38a2 commit 95d6c86
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/clauth/endpoints.clj
Expand Up @@ -236,7 +236,8 @@
[req {:keys [client-lookup token-lookup token-creator]}]
(let [params (req :params)
client (client-lookup (params :client_id))
user (:subject (token-lookup (:access_token (req :session))))
token (mw/req->token req token-lookup)
user (:subject token)
token (token-creator client user)]
(authorization-response req {:access_token (:token token)
:token_type "bearer"})))
Expand All @@ -245,7 +246,8 @@
[req {:keys [client-lookup token-lookup auth-code-creator]}]
(let [params (req :params)
client (client-lookup (params :client_id))
user (:subject (token-lookup (:access_token (req :session))))
token (mw/req->token req token-lookup)
user (:subject token)
code (auth-code-creator client user (:redirect_uri params))]
(authorization-response req {:code (:code code)})))

Expand Down Expand Up @@ -275,7 +277,7 @@
:token-creator clauth.token/create-token
:auth-code-creator clauth.auth-code/create-auth-code}
config)
authorization-form (config :authorization-form)]
authorization-form (config :authorization-form)]
(mw/require-user-session!
(mw/csrf-protect!
(fn [{:keys [params] :as req}]
Expand Down

0 comments on commit 95d6c86

Please sign in to comment.