mirror of
https://github.com/nais/wonderwall.git
synced 2026-05-09 01:47:03 +00:00
35 lines
532 B
Go
35 lines
532 B
Go
package cookie
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
type Options struct {
|
|
ExpiresIn time.Duration
|
|
SameSite http.SameSite
|
|
Secure bool
|
|
}
|
|
|
|
func DefaultOptions() Options {
|
|
return Options{
|
|
SameSite: http.SameSiteLaxMode,
|
|
Secure: true,
|
|
}
|
|
}
|
|
|
|
func (o Options) WithSameSite(sameSite http.SameSite) Options {
|
|
o.SameSite = sameSite
|
|
return o
|
|
}
|
|
|
|
func (o Options) WithExpiresIn(expiresIn time.Duration) Options {
|
|
o.ExpiresIn = expiresIn
|
|
return o
|
|
}
|
|
|
|
func (o Options) WithSecure(secure bool) Options {
|
|
o.Secure = secure
|
|
return o
|
|
}
|