Documentation ¶
Index ¶
- type CookieStore
- func (s *CookieStore) DeleteByID(ids ...string) error
- func (s *CookieStore) Get(r *http.Request, name string) (*sessions.Session, error)
- func (s *CookieStore) GetAll() ([]*sessions.Session, error)
- func (s *CookieStore) MaxAge(age int)
- func (s *CookieStore) New(r *http.Request, name string) (*sessions.Session, error)
- func (c *CookieStore) Options(options *sessions.Options)
- func (s *CookieStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
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 ¶
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) 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 ¶
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.