Documentation ¶
Index ¶
- Variables
- type CookieToken
- type MongoDBStore
- func (m *MongoDBStore) Get(r *http.Request, name string) (*sessions.Session, error)
- func (m *MongoDBStore) MaxAge(age int)
- func (m *MongoDBStore) New(r *http.Request, name string) (*sessions.Session, error)
- func (m *MongoDBStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
- type Session
- type TokenGetSetter
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidID = errors.New("mongodbstore: invalid session id")
)
Error definitions
Functions ¶
This section is empty.
Types ¶
type CookieToken ¶
type CookieToken struct{}
func (*CookieToken) SetToken ¶
func (c *CookieToken) SetToken(rw http.ResponseWriter, name, value string, options *sessions.Options)
type MongoDBStore ¶
type MongoDBStore struct { Codecs []securecookie.Codec Options *sessions.Options Token TokenGetSetter // contains filtered or unexported fields }
MongoDBStore stores sessions in MongoDB
func NewMongoDBStore ¶
func NewMongoDBStore(c *mongo.Collection, maxAge int, ensureTTL bool, keyPairs ...[]byte) *MongoDBStore
NewMongoDBStore returns a new MongoDBStore. Set ensureTTL to true let the database auto-remove expired object by maxAge.
func (*MongoDBStore) Get ¶
Get registers and returns a session for the given name and session store. It returns a new session if there are no sessions registered for the name.
func (*MongoDBStore) MaxAge ¶
func (m *MongoDBStore) 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 session.
func (*MongoDBStore) New ¶
New returns a session for the given name without adding it to the registry.
func (*MongoDBStore) Save ¶
func (m *MongoDBStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Save saves all sessions registered for the current request.
Click to show internal directories.
Click to hide internal directories.