#2: Started work, not yet working.

This commit is contained in:
Simon Brooke 2018-08-08 12:45:49 +01:00
parent 039b0eef3c
commit a6abeaa679
2 changed files with 17 additions and 9 deletions

View file

@ -2,7 +2,7 @@
{% block big-links %}
{% for authority in authorities %}
<div class="big-link-container">
<a href="auth?authority={{authority.id}}" class="big-link" id="{{authority.id}}-link">
<a href="oauth/oauth-init?authority={{authority.id}}" class="big-link" id="{{authority.id}}-link">
<img src="img/authorities/{{authority.id}}.png" width="32" height="32" alt="{{authority.id}}"/>
{{authority.id}}
</a>

View file

@ -6,17 +6,25 @@
[clojure.java.io :as io]
[youyesyet.oauth :as oauth]))
(defn oauth-init
"Initiates the OAuth with the authority implied by this `request`"
[request]
;; (-> (oauth/fetch-request-token request)
;; :oauth_token
;; oauth/auth-redirect-uri
;; found))
(found
(oauth/auth-redirect-uri
(:oauth_token (oauth/fetch-request-token request))
(:authority (:session request)))))
(let [authority (or
(:authority (:session request))
(oauth/authority! (:authority (massage-params :request))))]
(if
authority
(assoc-in
(found
(oauth/auth-redirect-uri
(:request-token
(oauth/fetch-request-token request authority))
authority))
[:session :authority]
authority))))
:session
(defn oauth-callback
"Handles the callback from the authority."