Package sessions
provides minimalist Go sessions, backed by securecookie
or database stores.
Store
provides a predicatable interface for dealing with individual sessions.New
returns a new namedSession
.Get
returns the namedSession
from thehttp.Request
iff it was correctly verified and decoded. Otherwise the error is non-nil.Save
encodes and signs Session.Value data.Destroy
removes (expires) the session cookie of a given name.
- Each
Session
providesSave
andDestroy
convenience methods. - Provides
CookieStore
for managing client-side secure cookies. - Extensible for custom session database backends.
go get github.com/dghubble/sessions
Read GoDoc
- Gorilla stores a context map of Requests to Sessions to abstract multiple sessions.
dghubble/sessions
provides individual sessions, leaving multiple sessions to amultisessions
package. No Registry is needed. - Gorilla has a depedency on
gorilla/context
, a non-standard context. - Gorilla requires all handlers be wrapped in
context.ClearHandler
to avoid memory leaks. - Gorilla's
Store
interface is surprising.New
andGet
can both possibly return a new session, a field check is needed. Some use cases expect developers to ignore an error.Destroy
isn't provided.