#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 %} {% block big-links %}
{% for authority in authorities %} {% for authority in authorities %}
<div class="big-link-container"> <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}}"/> <img src="img/authorities/{{authority.id}}.png" width="32" height="32" alt="{{authority.id}}"/>
{{authority.id}} {{authority.id}}
</a> </a>

View file

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