Skip to content

Commit

Permalink
Fixed clack.middleware.oauth.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomohiro Matsuyama committed May 10, 2011
1 parent e341d9c commit c05c052
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
*.fasl
*.dx32fsl
*.dx64fsl
*.lx32fsl
*.lx64fsl
*.x86f
14 changes: 8 additions & 6 deletions src/contrib/middleware/oauth.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
(cl-oauth:make-consumer-token
:key (oauth-consumer-key this)
:secret (oauth-consumer-secret this))
:callback-uri (format nil "~a~a" (oauth-callback-base this) (oauth-path this))))
:callback-uri (concatenate 'string
(oauth-callback-base this)
(oauth-path this))))
(state (oauth-state this)))
(when (gethash (cl-oauth:token-key req-token) state)
(error "OAuth request token collision is detected."))
Expand All @@ -50,7 +52,7 @@
req-token))

(defmethod obtain-request-token ((this <clack-middleware-oauth>) req)
(bind ((oauth-token (query-parameters req "oauth_token"))
(bind ((oauth-token (query-parameter req "oauth_token"))
((req-token time) (gethash oauth-token (oauth-state this))))
@ignore time
req-token))
Expand All @@ -73,8 +75,8 @@
(< (- now (second it)) (oauth-state-expire this))))))

(defmethod is-authorizing ((this <clack-middleware-oauth>) req)
(let ((oauth-token (query-parameters req "oauth_token"))
(oauth-verifier (query-parameters req "oauth_verifier")))
(let ((oauth-token (query-parameter req "oauth_token"))
(oauth-verifier (query-parameter req "oauth_verifier")))
(and oauth-token oauth-verifier
(not (is-expired this oauth-token)))))

Expand All @@ -91,8 +93,8 @@
(finalize res)))

(defmethod authorize-cont ((this <clack-middleware-oauth>) req)
(let ((oauth-token (query-parameters req "oauth_token"))
(oauth-verifier (query-parameters req "oauth_verifier"))
(let ((oauth-token (query-parameter req "oauth_token"))
(oauth-verifier (query-parameter req "oauth_verifier"))
(req-token (obtain-request-token this req)))
(setf (cl-oauth:request-token-verification-code req-token) oauth-verifier)
(cl-oauth:authorize-request-token req-token)
Expand Down

0 comments on commit c05c052

Please sign in to comment.