mirror of
https://github.com/penpot/penpot.git
synced 2026-06-04 22:50:19 +00:00
29 lines
890 B
Clojure
29 lines
890 B
Clojure
;; This Source Code Form is subject to the terms of the Mozilla Public
|
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
;;
|
|
;; Copyright (c) KALEIDOS INC
|
|
|
|
(ns app.rpc.mutations.verify-token
|
|
(:require
|
|
[app.db :as db]
|
|
[app.rpc.commands.verify-token :refer [process-token]]
|
|
[app.rpc.doc :as-alias doc]
|
|
[app.tokens :as tokens]
|
|
[app.util.services :as sv]
|
|
[clojure.spec.alpha :as s]))
|
|
|
|
(s/def ::verify-token
|
|
(s/keys :req-un [::token]
|
|
:opt-un [::profile-id]))
|
|
|
|
(sv/defmethod ::verify-token
|
|
{:auth false
|
|
::doc/added "1.1"
|
|
::doc/deprecated "1.15"}
|
|
[{:keys [pool sprops] :as cfg} {:keys [token] :as params}]
|
|
(db/with-atomic [conn pool]
|
|
(let [claims (tokens/verify sprops {:token token})
|
|
cfg (assoc cfg :conn conn)]
|
|
(process-token cfg params claims))))
|