stores

package
v0.0.0-...-f34d141 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const PREFIX = "LOCKLESS-COOKIE-NEW-"

Variables

This section is empty.

Functions

func DefaultCookie

func DefaultCookie() http.Cookie

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) Get

func (t LockfreeCookie) Get(r *http.Request, name string) (*sessions.Session, error)

Get see New

func (LockfreeCookie) New

func (t LockfreeCookie) New(r *http.Request, name string) (*sessions.Session, error)

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

Save adds a single session to the response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL