From 09bc12fe374a0ae0ba812d15b6662a3d780d00fc Mon Sep 17 00:00:00 2001 From: Abhishek Date: Mon, 7 Feb 2022 17:58:16 +0530 Subject: [PATCH 1/8] chore: add SessionOnly key in ctx Cookie struct docs --- api/ctx.md | 19 ++++++++++--------- original/context.md | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/api/ctx.md b/api/ctx.md index b8b186226e2..1ebe56b4ae9 100644 --- a/api/ctx.md +++ b/api/ctx.md @@ -318,15 +318,16 @@ func (c *Ctx) Cookie(cookie *Cookie) ```go type Cookie struct { - Name string `json:"name"` - Value string `json:"value"` - Path string `json:"path"` - Domain string `json:"domain"` - MaxAge int `json:"max_age"` - Expires time.Time `json:"expires"` - Secure bool `json:"secure"` - HTTPOnly bool `json:"http_only"` - SameSite string `json:"same_site"` + Name string `json:"name"` + Value string `json:"value"` + Path string `json:"path"` + Domain string `json:"domain"` + MaxAge int `json:"max_age"` + Expires time.Time `json:"expires"` + Secure bool `json:"secure"` + HTTPOnly bool `json:"http_only"` + SameSite string `json:"same_site"` + SessionOnly bool `json:"session_only"` } ``` diff --git a/original/context.md b/original/context.md index 20e779aa4d6..71bd8725a73 100644 --- a/original/context.md +++ b/original/context.md @@ -232,14 +232,16 @@ c.Cookie(*Cookie) ```go type Cookie struct { - Name string - Value string - Path string - Domain string - Expires time.Time - Secure bool - HTTPOnly bool - SameSite string // lax, strict, none + Name string + Value string + Path string + Domain string + MaxAge int + Expires time.Time + Secure bool + HTTPOnly bool + SameSite string // lax, strict, none + SessionOnly bool } ``` From 0d29092a0e54c78d3b440ed5a06eda0b5f9e68c5 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Mon, 7 Feb 2022 18:19:17 +0530 Subject: [PATCH 2/8] revert: undo change in context.md file --- original/context.md | 1 - 1 file changed, 1 deletion(-) diff --git a/original/context.md b/original/context.md index 71bd8725a73..9da4b52802b 100644 --- a/original/context.md +++ b/original/context.md @@ -241,7 +241,6 @@ type Cookie struct { Secure bool HTTPOnly bool SameSite string // lax, strict, none - SessionOnly bool } ``` From 9431ec9cbceb7a5268a320db2c096c00da4709a1 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Mon, 7 Feb 2022 18:20:46 +0530 Subject: [PATCH 3/8] chore(csrf): update csrf config docs --- api/middleware/csrf.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/middleware/csrf.md b/api/middleware/csrf.md index a25e1565888..69fc878baa3 100644 --- a/api/middleware/csrf.md +++ b/api/middleware/csrf.md @@ -88,6 +88,10 @@ type Config struct { // Optional. Default value "Lax". CookieSameSite string + // Decides whether cookie should last for only the browser sesison. + // Ignores Expiration if set to true + CookieSessionOnly bool + // Expiration is the duration before csrf token will expire // // Optional. Default: 1 * time.Hour From 5287ffa03154dde07d100d0eb87d128de16c4e9f Mon Sep 17 00:00:00 2001 From: Abhishek Mehandiratta <36722596+abhi12299@users.noreply.github.com> Date: Tue, 8 Feb 2022 13:18:25 +0530 Subject: [PATCH 4/8] chore(ctx): fix indentation --- api/ctx.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/api/ctx.md b/api/ctx.md index 1ebe56b4ae9..623dc8a9973 100644 --- a/api/ctx.md +++ b/api/ctx.md @@ -318,16 +318,16 @@ func (c *Ctx) Cookie(cookie *Cookie) ```go type Cookie struct { - Name string `json:"name"` - Value string `json:"value"` - Path string `json:"path"` - Domain string `json:"domain"` - MaxAge int `json:"max_age"` - Expires time.Time `json:"expires"` - Secure bool `json:"secure"` - HTTPOnly bool `json:"http_only"` - SameSite string `json:"same_site"` - SessionOnly bool `json:"session_only"` + Name string `json:"name"` + Value string `json:"value"` + Path string `json:"path"` + Domain string `json:"domain"` + MaxAge int `json:"max_age"` + Expires time.Time `json:"expires"` + Secure bool `json:"secure"` + HTTPOnly bool `json:"http_only"` + SameSite string `json:"same_site"` + SessionOnly bool `json:"session_only"` } ``` From af07a61fcd67207dd2a7ec410ba63fdf47f2462d Mon Sep 17 00:00:00 2001 From: Abhishek Mehandiratta <36722596+abhi12299@users.noreply.github.com> Date: Tue, 8 Feb 2022 13:19:15 +0530 Subject: [PATCH 5/8] chore(csrf): correct indentation --- api/middleware/csrf.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/middleware/csrf.md b/api/middleware/csrf.md index 69fc878baa3..8c6989e022e 100644 --- a/api/middleware/csrf.md +++ b/api/middleware/csrf.md @@ -89,8 +89,8 @@ type Config struct { CookieSameSite string // Decides whether cookie should last for only the browser sesison. - // Ignores Expiration if set to true - CookieSessionOnly bool + // Ignores Expiration if set to true + CookieSessionOnly bool // Expiration is the duration before csrf token will expire // From 6ce0cff9f9f1dbed4124ca4df88ef86c08754312 Mon Sep 17 00:00:00 2001 From: Abhishek Mehandiratta <36722596+abhi12299@users.noreply.github.com> Date: Tue, 8 Feb 2022 13:20:33 +0530 Subject: [PATCH 6/8] chore(context): fix indentation --- original/context.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/original/context.md b/original/context.md index 9da4b52802b..c1d3cff0e2f 100644 --- a/original/context.md +++ b/original/context.md @@ -232,15 +232,15 @@ c.Cookie(*Cookie) ```go type Cookie struct { - Name string - Value string - Path string - Domain string - MaxAge int - Expires time.Time - Secure bool - HTTPOnly bool - SameSite string // lax, strict, none + Name string + Value string + Path string + Domain string + MaxAge int + Expires time.Time + Secure bool + HTTPOnly bool + SameSite string // lax, strict, none } ``` From 08bf6ad29a96d735b0c8d1417f9af8cce02cca28 Mon Sep 17 00:00:00 2001 From: RW Date: Tue, 8 Feb 2022 09:07:00 +0100 Subject: [PATCH 7/8] fix indentation --- original/context.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/original/context.md b/original/context.md index c1d3cff0e2f..4772345735b 100644 --- a/original/context.md +++ b/original/context.md @@ -232,15 +232,15 @@ c.Cookie(*Cookie) ```go type Cookie struct { - Name string - Value string - Path string - Domain string - MaxAge int - Expires time.Time - Secure bool - HTTPOnly bool - SameSite string // lax, strict, none + Name string + Value string + Path string + Domain string + MaxAge int + Expires time.Time + Secure bool + HTTPOnly bool + SameSite string // lax, strict, none } ``` From 4c52a83d045ae9c30df6356f4d9850edfb42d88b Mon Sep 17 00:00:00 2001 From: RW Date: Tue, 8 Feb 2022 09:08:24 +0100 Subject: [PATCH 8/8] fix indentation --- api/ctx.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/api/ctx.md b/api/ctx.md index 623dc8a9973..1a98cade0c1 100644 --- a/api/ctx.md +++ b/api/ctx.md @@ -318,16 +318,16 @@ func (c *Ctx) Cookie(cookie *Cookie) ```go type Cookie struct { - Name string `json:"name"` - Value string `json:"value"` - Path string `json:"path"` - Domain string `json:"domain"` - MaxAge int `json:"max_age"` - Expires time.Time `json:"expires"` - Secure bool `json:"secure"` - HTTPOnly bool `json:"http_only"` - SameSite string `json:"same_site"` - SessionOnly bool `json:"session_only"` + Name string `json:"name"` + Value string `json:"value"` + Path string `json:"path"` + Domain string `json:"domain"` + MaxAge int `json:"max_age"` + Expires time.Time `json:"expires"` + Secure bool `json:"secure"` + HTTPOnly bool `json:"http_only"` + SameSite string `json:"same_site"` + SessionOnly bool `json:"session_only"` } ```