aboutsummaryrefslogtreecommitdiff
path: root/src/dummy_auth/routes.clj
blob: 8ecdc1c0b1a3d7fbee12e9bcba35edb23fb44c06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(ns dummy-auth.routes
  (:require [reitit.ring :as rring]
            [ring.middleware.params :as rmparams]
            [ring.middleware.json :as rmjson]

            [dummy-auth.error :as derror]
            [dummy-auth.oauth2.auth :as do2auth]
            [dummy-auth.oauth2.token :as do2token]
            [dummy-auth.oidc.userinfo :as doidcuserinfo]))

(def routes [["/oauth2"
              ["/authorize" {:get {:handler do2auth/handle}}]
              ["/token" {:post {:handler do2token/handle}}]]
             ["/oidc"
              ["/userinfo" {:get  {:handler doidcuserinfo/handle}
                            :post {:handler doidcuserinfo/handle}}]]
             ["/error" {:get {:handler derror/handle}}]])

(def ring-handler (-> routes
                      rring/router
                      rring/ring-handler
                      rmjson/wrap-json-response
                      rmparams/wrap-params))