mirror of
https://github.com/penpot/penpot.git
synced 2025-05-24 14:26:43 +02:00
🔥 Replace spec with schema on ldap RPC methods
This commit is contained in:
parent
85108672bf
commit
c4cf745d77
1 changed files with 9 additions and 11 deletions
|
@ -8,7 +8,7 @@
|
||||||
(:require
|
(:require
|
||||||
[app.auth.ldap :as ldap]
|
[app.auth.ldap :as ldap]
|
||||||
[app.common.exceptions :as ex]
|
[app.common.exceptions :as ex]
|
||||||
[app.common.spec :as us]
|
[app.common.schema :as sm]
|
||||||
[app.db :as db]
|
[app.db :as db]
|
||||||
[app.http.session :as session]
|
[app.http.session :as session]
|
||||||
[app.loggers.audit :as-alias audit]
|
[app.loggers.audit :as-alias audit]
|
||||||
|
@ -19,27 +19,25 @@
|
||||||
[app.rpc.helpers :as rph]
|
[app.rpc.helpers :as rph]
|
||||||
[app.setup :as-alias setup]
|
[app.setup :as-alias setup]
|
||||||
[app.tokens :as tokens]
|
[app.tokens :as tokens]
|
||||||
[app.util.services :as sv]
|
[app.util.services :as sv]))
|
||||||
[clojure.spec.alpha :as s]))
|
|
||||||
|
|
||||||
;; --- COMMAND: login-with-ldap
|
;; --- COMMAND: login-with-ldap
|
||||||
|
|
||||||
(declare login-or-register)
|
(declare login-or-register)
|
||||||
|
|
||||||
(s/def ::email ::us/email)
|
(def schema:login-with-ldap
|
||||||
(s/def ::password ::us/string)
|
[:map {:title "login-with-ldap"}
|
||||||
(s/def ::invitation-token ::us/string)
|
[:email ::sm/email]
|
||||||
|
[:password auth/schema:password]
|
||||||
(s/def ::login-with-ldap
|
[:invitation-token {:optional true} auth/schema:token]])
|
||||||
(s/keys :req-un [::email ::password]
|
|
||||||
:opt-un [::invitation-token]))
|
|
||||||
|
|
||||||
(sv/defmethod ::login-with-ldap
|
(sv/defmethod ::login-with-ldap
|
||||||
"Performs the authentication using LDAP backend. Only works if LDAP
|
"Performs the authentication using LDAP backend. Only works if LDAP
|
||||||
is properly configured and enabled with `login-with-ldap` flag."
|
is properly configured and enabled with `login-with-ldap` flag."
|
||||||
{::rpc/auth false
|
{::rpc/auth false
|
||||||
::doc/added "1.15"
|
::doc/added "1.15"
|
||||||
::doc/module :auth}
|
::doc/module :auth
|
||||||
|
::sm/params schema:login-with-ldap}
|
||||||
[{:keys [::setup/props ::ldap/provider] :as cfg} params]
|
[{:keys [::setup/props ::ldap/provider] :as cfg} params]
|
||||||
(when-not provider
|
(when-not provider
|
||||||
(ex/raise :type :restriction
|
(ex/raise :type :restriction
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue