Documentation
¶
Overview ¶
Package cookie implements all cookie handling for the session package
Index ¶
- type CookieClient
- func (c *CookieClient) HasValidXSRFToken(r *http.Request) bool
- func (c *CookieClient) NewAuthCookie(w http.ResponseWriter, sameSiteStrict bool, sessionID ccc.UUID) (map[types.SCKey]string, error)
- func (c *CookieClient) ReadAuthCookie(r *http.Request) (map[types.SCKey]string, bool)
- func (c *CookieClient) ReadXSRFCookie(r *http.Request) (map[types.STKey]string, bool)
- func (c *CookieClient) ReadXSRFHeader(r *http.Request) (map[types.STKey]string, bool)
- func (c *CookieClient) SetXSRFTokenCookie(w http.ResponseWriter, r *http.Request, sessionID ccc.UUID, ...) (set bool)
- func (c *CookieClient) WriteAuthCookie(w http.ResponseWriter, sameSiteStrict bool, cval map[types.SCKey]string) error
- func (c *CookieClient) WriteXSRFCookie(w http.ResponseWriter, cookieExpiration time.Duration, ...) error
- type CookieHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CookieClient ¶
type CookieClient struct {
CookieName string
Domain string
// contains filtered or unexported fields
}
CookieClient implements all cookie management for session package
func NewCookieClient ¶
func NewCookieClient(secureCookie *securecookie.SecureCookie) *CookieClient
NewCookieClient returns a new CookieClient
func (*CookieClient) HasValidXSRFToken ¶
func (c *CookieClient) HasValidXSRFToken(r *http.Request) bool
HasValidXSRFToken checks if the XSRF token is valid
func (*CookieClient) NewAuthCookie ¶
func (c *CookieClient) NewAuthCookie(w http.ResponseWriter, sameSiteStrict bool, sessionID ccc.UUID) (map[types.SCKey]string, error)
NewAuthCookie writes a new Auth Cookie for given sessionID
func (*CookieClient) ReadAuthCookie ¶
ReadAuthCookie reads the Auth cookie from the request
func (*CookieClient) ReadXSRFCookie ¶
ReadXSRFCookie reads the XSRF cookie from the request
func (*CookieClient) ReadXSRFHeader ¶
ReadXSRFHeader reads the XSRF header from the request
func (*CookieClient) SetXSRFTokenCookie ¶
func (c *CookieClient) SetXSRFTokenCookie(w http.ResponseWriter, r *http.Request, sessionID ccc.UUID, cookieExpiration time.Duration) (set bool)
SetXSRFTokenCookie sets the cookie if it does not exist and updates the cookie when it is close to expiration.
func (*CookieClient) WriteAuthCookie ¶
func (c *CookieClient) WriteAuthCookie(w http.ResponseWriter, sameSiteStrict bool, cval map[types.SCKey]string) error
WriteAuthCookie writes the Auth cookie to the response
func (*CookieClient) WriteXSRFCookie ¶
func (c *CookieClient) WriteXSRFCookie(w http.ResponseWriter, cookieExpiration time.Duration, cval map[types.STKey]string) error
WriteXSRFCookie writes the XSRF cookie to the response
type CookieHandler ¶
type CookieHandler interface {
NewAuthCookie(w http.ResponseWriter, sameSiteStrict bool, sessionID ccc.UUID) (map[types.SCKey]string, error)
ReadAuthCookie(r *http.Request) (map[types.SCKey]string, bool)
WriteAuthCookie(w http.ResponseWriter, sameSiteStrict bool, cval map[types.SCKey]string) error
SetXSRFTokenCookie(w http.ResponseWriter, r *http.Request, sessionID ccc.UUID, cookieExpiration time.Duration) (set bool)
HasValidXSRFToken(r *http.Request) bool
}
CookieHandler Interface included for testability