Files
wonderwall/pkg/cookie/options.go
Trong Huu Nguyen 9c2d1cb520 feat(cookie): remove expiry options
Always create session cookies instead of
persistent cookies with expiry.
2023-12-19 08:46:08 +01:00

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
}