mirror of
https://github.com/nais/wonderwall.git
synced 2026-02-14 17:49:54 +00:00
40 lines
589 B
Go
40 lines
589 B
Go
package cookie
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
type Options struct {
|
|
Domain string
|
|
Path string
|
|
SameSite http.SameSite
|
|
Secure bool
|
|
}
|
|
|
|
func DefaultOptions() Options {
|
|
return Options{
|
|
SameSite: http.SameSiteLaxMode,
|
|
Secure: true,
|
|
}
|
|
}
|
|
|
|
func (o Options) WithDomain(domain string) Options {
|
|
o.Domain = domain
|
|
return o
|
|
}
|
|
|
|
func (o Options) WithPath(path string) Options {
|
|
o.Path = path
|
|
return o
|
|
}
|
|
|
|
func (o Options) WithSameSite(sameSite http.SameSite) Options {
|
|
o.SameSite = sameSite
|
|
return o
|
|
}
|
|
|
|
func (o Options) WithSecure(secure bool) Options {
|
|
o.Secure = secure
|
|
return o
|
|
}
|