From 55c06d186188c24ab154119f968b38e4894199ec Mon Sep 17 00:00:00 2001 From: Mikkel Gravgaard Date: Fri, 16 Nov 2018 23:30:21 +0100 Subject: [PATCH] Re-implement cookie auth Re-implement cookie auth by looking for the cookie name in the "default" realm under the `:cookie` key --- src/yada/security.clj | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/yada/security.clj b/src/yada/security.clj index a620720b..c6d3ad9a 100644 --- a/src/yada/security.clj +++ b/src/yada/security.clj @@ -19,11 +19,10 @@ (let [[user password] (str/split (str cred) #":" 2)] (verify [user password]))))) -#_(defmethod verify :cookie [ctx {:keys [verify cookie]}] - - (get-in ctx [:cookies cookie]) - - ) +(defmethod yada.security/verify :cookie [{cookie-map :cookies + {{{{{cookie-name :cookie} :authorization} "default"} :realms} :access-control} :resource} + {verify-fn :verify}] + (verify-fn (get cookie-map cookie-name))) ;; A nil scheme is simply one that does not use any of the built-in ;; algorithms for IANA registered auth-schemes at