Documentation
¶
Index ¶
Constants ¶
const PREFIX = "LOCKLESS-COOKIE-NEW-"
Variables ¶
This section is empty.
Functions ¶
func DefaultCookie ¶
Types ¶
type LockfreeCookie ¶
type LockfreeCookie struct { Codecs []securecookie.Codec CookieTemplate http.Cookie }
LockfreeCookie stores sessions using secure cookies.
func DefaultLockfreeCookie ¶
func DefaultLockfreeCookie() *LockfreeCookie
EXPERIMENTAL Session Storage LockfreeCookie ----------------------------------------------------------------
func NewLockfreeCookie ¶
func NewLockfreeCookie(keyPairs ...[]byte) *LockfreeCookie
NewLockfreeCookie returns a new LockfreeCookie.
Keys are defined in pairs to allow key rotation, but the common case is to set a single authentication key and optionally an encryption key.
The first key in a pair is used for authentication and the second for encryption. The encryption key can be set to nil or omitted in the last pair, but the authentication key is required in all pairs.
It is recommended to use an authentication key with 32 or 64 bytes. The encryption key, if set, must be either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256 modes.
Use the convenience function securecookie.GenerateRandomKey() to create strong keys.
func (LockfreeCookie) New ¶
New returns a session for the given name.
It returns a new session if the session doesn't exist. Access IsNew on the session to check if it is an existing session or a new one.
It returns a new session and an error if the session exists but could not be decoded.
func (LockfreeCookie) Save ¶
func (t LockfreeCookie) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Save adds a single session to the response.