From 5314290bbec53379372d14234fdc4f28cbe3286a Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 31 Dec 2024 16:23:46 +0100 Subject: Initial commit --- src/dummy_auth/oauth2/auth.clj | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/dummy_auth/oauth2/auth.clj (limited to 'src/dummy_auth/oauth2/auth.clj') 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))) -- cgit v1.2.3