mirror of
https://github.com/penpot/penpot.git
synced 2025-06-05 19:11:41 +02:00
🎉 Add generic oauth2/openid-connect authentication subsystem.
This commit is contained in:
parent
9e5923004f
commit
63b95e71a7
17 changed files with 368 additions and 620 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
(ns app.main.repo
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[beicon.core :as rx]
|
||||
[lambdaisland.uri :as u]
|
||||
[cuerdas.core :as str]
|
||||
|
@ -84,23 +85,10 @@
|
|||
([id] (mutation id {}))
|
||||
([id params] (mutation id params)))
|
||||
|
||||
(defmethod mutation :login-with-google
|
||||
[id params]
|
||||
(let [uri (u/join base-uri "api/oauth/google")]
|
||||
(->> (http/send! {:method :post :uri uri :query params})
|
||||
(rx/map http/conditional-decode-transit)
|
||||
(rx/mapcat handle-response))))
|
||||
|
||||
(defmethod mutation :login-with-gitlab
|
||||
[id params]
|
||||
(let [uri (u/join base-uri "api/oauth/gitlab")]
|
||||
(->> (http/send! {:method :post :uri uri :query params})
|
||||
(rx/map http/conditional-decode-transit)
|
||||
(rx/mapcat handle-response))))
|
||||
|
||||
(defmethod mutation :login-with-github
|
||||
[id params]
|
||||
(let [uri (u/join base-uri "api/oauth/github")]
|
||||
(defmethod mutation :login-with-oauth
|
||||
[id {:keys [provider] :as params}]
|
||||
(let [uri (u/join base-uri "api/auth/oauth/" (d/name provider))
|
||||
params (dissoc params :provider)]
|
||||
(->> (http/send! {:method :post :uri uri :query params})
|
||||
(rx/map http/conditional-decode-transit)
|
||||
(rx/mapcat handle-response))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue