0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 15:39:50 -05:00

Add more logging to OIDC providers

This commit is contained in:
Andrey Antukh 2023-02-07 14:41:06 +01:00
parent ab3b9cba45
commit 69556f19ac

View file

@ -168,7 +168,7 @@
(->> (write! manager token params) (->> (write! manager token params)
(p/fmap (fn [session] (p/fmap (fn [session]
(l/trace :hint "create" :profile-id profile-id) (l/trace :hint "create" :profile-id (str profile-id))
(-> response (-> response
(assign-auth-token-cookie session) (assign-auth-token-cookie session)
(assign-authenticated-cookie session))))))))) (assign-authenticated-cookie session)))))))))
@ -301,13 +301,16 @@
(defn- assign-authenticated-cookie (defn- assign-authenticated-cookie
[response {updated-at :updated-at}] [response {updated-at :updated-at}]
(let [max-age (cf/get :auth-token-cookie-max-age default-cookie-max-age) (let [max-age (cf/get :auth-token-cookie-max-age default-cookie-max-age)
domain (cf/get :authenticated-cookie-domain)
cname (cf/get :authenticated-cookie-name "authenticated")
created-at (or updated-at (dt/now)) created-at (or updated-at (dt/now))
renewal (dt/plus created-at default-renewal-max-age) renewal (dt/plus created-at default-renewal-max-age)
expires (dt/plus created-at max-age) expires (dt/plus created-at max-age)
comment (str "Renewal at: " (dt/format-instant renewal :rfc1123)) comment (str "Renewal at: " (dt/format-instant renewal :rfc1123))
secure? (contains? cf/flags :secure-session-cookies) secure? (contains? cf/flags :secure-session-cookies)
domain (cf/get :authenticated-cookie-domain)
name (cf/get :authenticated-cookie-name "authenticated")
cookie {:domain domain cookie {:domain domain
:expires expires :expires expires
:path "/" :path "/"
@ -317,20 +320,20 @@
:secure secure?}] :secure secure?}]
(cond-> response (cond-> response
(string? domain) (string? domain)
(update :cookies assoc name cookie)))) (update :cookies assoc cname cookie))))
(defn- clear-auth-token-cookie (defn- clear-auth-token-cookie
[response] [response]
(let [cname (cf/get :auth-token-cookie-name default-auth-token-cookie-name)] (let [cname (cf/get :auth-token-cookie-name default-auth-token-cookie-name)]
(update response :cookies assoc cname {:path "/" :value "" :max-age -1}))) (update response :cookies assoc cname {:path "/" :value "" :max-age 0})))
(defn- clear-authenticated-cookie (defn- clear-authenticated-cookie
[response] [response]
(let [cname (cf/get :authenticated-cookie-name default-authenticated-cookie-name) (let [cname (cf/get :authenticated-cookie-name default-authenticated-cookie-name)
domain (cf/get :authenticated-cookie-domain)] domain (cf/get :authenticated-cookie-domain)]
(cond-> response (cond-> response
(string? domain) (string? domain)
(update :cookies assoc cname {:domain domain :path "/" :value "" :max-age -1})))) (update :cookies assoc cname {:domain domain :path "/" :value "" :max-age 0}))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;