summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-06-19 12:17:46 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2012-06-19 12:17:46 +0200
commit6dfdba0d9a21335faf3fc665646afb4402f1f812 (patch)
treebcd1aad2c7abaddf880a1901c5ab31bb5cc96695 /src
parentb66de5eb3dc7d712413044a178b619f326f3aa8a (diff)
Accept /~:nickname as OpenID in addition to /id/:nickname.
Diffstat (limited to 'src')
-rw-r--r--src/mulk/benki/id.clj15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mulk/benki/id.clj b/src/mulk/benki/id.clj
index 56a86ee..a6ba042 100644
--- a/src/mulk/benki/id.clj
+++ b/src/mulk/benki/id.clj
@@ -20,7 +20,8 @@
(doto (ServerManager.)
(.setOPEndpointUrl (str (:base-uri @benki-config) "/openid"))))
-(def profile-base-uri (str (:base-uri @benki-config) "/id/"))
+(def profile-base-uris #{(str (:base-uri @benki-config) "/id/")
+ (str (:base-uri @benki-config) "/~")})
(defn nickname-user [nickname]
(with-dbt
@@ -33,11 +34,13 @@
{:status 403, :type "text/plain", :body "Not authorized."})
(defn nickname-from-profile-uri [uri]
- (let [base-uri (.substring uri 0 (.length profile-base-uri))
- nickname (.substring uri (.length profile-base-uri))]
- (if (= base-uri profile-base-uri)
- nickname
- nil)))
+ (some (fn [profile-base-uri]
+ (let [base-uri (.substring uri 0 (.length profile-base-uri))
+ nickname (.substring uri (.length profile-base-uri))]
+ (if (= base-uri profile-base-uri)
+ nickname
+ nil)))
+ profile-base-uris))
(defn format-openid-response [s]
{:status 200, :type "text/plain", :body s})