🎉 Add authenticate prepl rpc method

This commit is contained in:
Andrey Antukh 2025-04-15 15:31:20 +02:00
parent 2df6f2b8b1
commit 952ab032f9

View file

@ -13,6 +13,8 @@
[app.db :as db]
[app.rpc.commands.auth :as cmd.auth]
[app.rpc.commands.profile :as cmd.profile]
[app.setup :as-alias setup]
[app.tokens :as tokens]
[app.util.time :as dt]
[cuerdas.core :as str]))
@ -109,6 +111,12 @@
[{:keys [password]}]
(auth/derive-password password))
(defmethod exec-command "authenticate"
[{:keys [token]}]
(when-let [system (get-current-system)]
(let [props (get system ::setup/props)]
(tokens/verify props {:token token :iss "authentication"}))))
(defmethod exec-command :default
[{:keys [::cmd]}]
(ex/raise :type :internal