diff options
author | Tim <contact@bytim.eu> | 2024-12-31 16:23:46 +0100 |
---|---|---|
committer | Tim <contact@bytim.eu> | 2024-12-31 16:23:46 +0100 |
commit | 5314290bbec53379372d14234fdc4f28cbe3286a (patch) | |
tree | 32bcb32e394873692d16ff7d2c436a71acf2f6b3 /src/dummy_auth/oauth2 | |
download | dummy-auth-5314290bbec53379372d14234fdc4f28cbe3286a.tar.xz dummy-auth-5314290bbec53379372d14234fdc4f28cbe3286a.zip |
Initial commit
Diffstat (limited to 'src/dummy_auth/oauth2')
-rw-r--r-- | src/dummy_auth/oauth2/auth.clj | 12 | ||||
-rw-r--r-- | src/dummy_auth/oauth2/token.clj | 9 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/dummy_auth/oauth2/auth.clj b/src/dummy_auth/oauth2/auth.clj new file mode 100644 index 0000000..50b4a0e --- /dev/null +++ b/src/dummy_auth/oauth2/auth.clj @@ -0,0 +1,12 @@ +(ns dummy-auth.oauth2.auth + (:require [ring.util.response :as ruresp])) + +(defn handle [req] + (let [redirect-uri (get-in req [:query-params "redirect_uri"]) + state (get-in req [:query-params "state"]) + redirection (cond + (and (some? redirect-uri) (some? state)) (str redirect-uri "?state=" state "&code=abc") + (some? redirect-uri) (str redirect-uri "?code=abc") + :else "/error")] + (println "oauth2/auth: redirecting to" redirection) + (ruresp/redirect redirection))) diff --git a/src/dummy_auth/oauth2/token.clj b/src/dummy_auth/oauth2/token.clj new file mode 100644 index 0000000..fd5a534 --- /dev/null +++ b/src/dummy_auth/oauth2/token.clj @@ -0,0 +1,9 @@ +(ns dummy-auth.oauth2.token + (:require [ring.util.response :as ruresp])) + +(defn handle [_req] + (println "oauth2/token: responding...") + (ruresp/response {"access_token" "abc" + "refresh_token" "abc" + "token_type" "Bearer" + "expires" 0})) |