cookie

package
v0.0.0-...-e22b688 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CookieStore

type CookieStore struct {
	Codecs []securecookie.Codec
	// contains filtered or unexported fields
}

CookieStore stores sessions using secure cookies.

func NewCookieStore

func NewCookieStore(keyPairs ...[]byte) *CookieStore

func (*CookieStore) DeleteByID

func (s *CookieStore) DeleteByID(ids ...string) error

func (*CookieStore) Get

func (s *CookieStore) Get(r *http.Request, name string) (*sessions.Session, error)

Get returns a session for the given name after adding it to the registry.

It returns a new session if the sessions 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 (*CookieStore) GetAll

func (s *CookieStore) GetAll() ([]*sessions.Session, error)

func (*CookieStore) MaxAge

func (s *CookieStore) MaxAge(age int)

MaxAge sets the maximum age for the store and the underlying cookie implementation. Individual sessions can be deleted by setting Options.MaxAge = -1 for that sessions.

func (*CookieStore) New

func (s *CookieStore) New(r *http.Request, name string) (*sessions.Session, error)

New returns a session for the given name without adding it to the registry.

The difference between New() and Get() is that calling New() twice will decode the session data twice, while Get() registers and reuses the same decoded session after the first call.

func (*CookieStore) Options

func (c *CookieStore) Options(options *sessions.Options)

func (*CookieStore) Save

func (s *CookieStore) Save(r *http.Request, w http.ResponseWriter,
	session *sessions.Session) error

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