Documentation
¶
Index ¶
- Constants
- type AppsecCookie
- func (c *AppsecCookie) Domain(domain string) *AppsecCookie
- func (c *AppsecCookie) ExpiresAt(t time.Time) *AppsecCookie
- func (c *AppsecCookie) ExpiresIn(d time.Duration) *AppsecCookie
- func (c *AppsecCookie) HttpOnly() *AppsecCookie
- func (c *AppsecCookie) Path(path string) *AppsecCookie
- func (c *AppsecCookie) SameSite(mode string) *AppsecCookie
- func (c *AppsecCookie) Secure() *AppsecCookie
- func (c *AppsecCookie) String() string
- func (c *AppsecCookie) Value(value string) *AppsecCookie
Constants ¶
const ( SameSiteLax = "Lax" SameSiteStrict = "Strict" SameSiteNone = "None" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppsecCookie ¶
type AppsecCookie struct {
Name string
Expiration int64
Val string
PathVal string
DomainName string
SecureFlag bool
HttpOnlyFlag bool
SameSiteMode string
}
AppsecCookie is the value-type passed around through expr rules to build up a Set-Cookie header. Rule authors construct it via cookie.AppsecCookie(name) and chain the builder methods below; the final String() call renders it to a Set-Cookie-compatible string.
func NewAppsecCookie ¶
func NewAppsecCookie(name string) *AppsecCookie
NewAppsecCookie returns a cookie pre-populated with sensible defaults. Defaults: Path "/", SameSite=Lax, session lifetime, not secure/httponly unless set.
func (*AppsecCookie) Domain ¶
func (c *AppsecCookie) Domain(domain string) *AppsecCookie
Domain sets the cookie Domain attribute. Leave unset to scope the cookie to the request host.
func (*AppsecCookie) ExpiresAt ¶
func (c *AppsecCookie) ExpiresAt(t time.Time) *AppsecCookie
ExpiresAt sets an absolute expiration time (unix seconds).
func (*AppsecCookie) ExpiresIn ¶
func (c *AppsecCookie) ExpiresIn(d time.Duration) *AppsecCookie
ExpiresIn sets the expiration relative to now.
func (*AppsecCookie) HttpOnly ¶
func (c *AppsecCookie) HttpOnly() *AppsecCookie
HttpOnly marks the cookie HttpOnly so it cannot be read from JS.
func (*AppsecCookie) Path ¶
func (c *AppsecCookie) Path(path string) *AppsecCookie
Path sets the cookie Path attribute; empty input restores the default ("/").
func (*AppsecCookie) SameSite ¶
func (c *AppsecCookie) SameSite(mode string) *AppsecCookie
SameSite sets the SameSite mode (Lax / Strict / None). Unknown values are passed through verbatim; validation happens on String() rendering.
func (*AppsecCookie) Secure ¶
func (c *AppsecCookie) Secure() *AppsecCookie
Secure marks the cookie Secure. Required when SameSite=None.
func (*AppsecCookie) String ¶
func (c *AppsecCookie) String() string
String formats the cookie into a Set-Cookie compatible string.
func (*AppsecCookie) Value ¶
func (c *AppsecCookie) Value(value string) *AppsecCookie
Value sets the cookie's value.