Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for Session only cookies #240

Merged
merged 8 commits into from Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 10 additions & 9 deletions api/ctx.md
Expand Up @@ -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"`
}
```

Expand Down
4 changes: 4 additions & 0 deletions api/middleware/csrf.md
Expand Up @@ -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
Expand Down
17 changes: 9 additions & 8 deletions original/context.md
Expand Up @@ -232,14 +232,15 @@ 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
}
```

Expand Down