From 32a6ceff34f2be4ae262605f3e4ac1d574c8034b Mon Sep 17 00:00:00 2001 From: dongxuny <50768414+dongxuny@users.noreply.github.com> Date: Tue, 9 Apr 2024 19:36:06 +0800 Subject: [PATCH] Add cookie option in CSRF --- middleware/csrf/options.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/middleware/csrf/options.go b/middleware/csrf/options.go index 25e09ff..9130efa 100644 --- a/middleware/csrf/options.go +++ b/middleware/csrf/options.go @@ -127,6 +127,8 @@ func NewOptionSet(opts ...Option) OptionSetInterface { parts := strings.Split(set.tokenLookup, ":") set.extractor = csrfTokenFromHeader(parts[1]) switch parts[0] { + case "cookie": + set.extractor = csrfTokenFromCookie(parts[1]) case "form": set.extractor = csrfTokenFromForm(parts[1]) case "query":