aboutsummaryrefslogtreecommitdiff
path: root/src/dummy_auth/oauth2/auth.clj
blob: 50b4a0e3f22527142577b469e2d0b6f69afe5d40 (plain)
1
2
3
4
5
6
7
8
9
10
11
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)))