Documentation ¶
Index ¶
- Constants
- type UserSessionStore
- func (store *UserSessionStore) Get(r *http.Request, name string) (*sessions.Session, error)
- func (store *UserSessionStore) GetName() string
- func (store *UserSessionStore) MaxAge(age int)
- func (store *UserSessionStore) MaxLength(l int)
- func (store *UserSessionStore) New(r *http.Request, name string) (*sessions.Session, error)
- func (store *UserSessionStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
- type UserSessionStoreOpt
- func WithCookieAllowInsecure(allow bool) UserSessionStoreOpt
- func WithCookieDomain(domain string) UserSessionStoreOpt
- func WithCookieName(name string) UserSessionStoreOpt
- func WithCookieSecrets(secrets ...string) UserSessionStoreOpt
- func WithSessionRepository(repo repository.UserSessionRepository) UserSessionStoreOpt
- type UserSessionStoreOpts
Constants ¶
View Source
const UserSessionKey string = "user_id"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserSessionStore ¶
type UserSessionStore struct {
// contains filtered or unexported fields
}
func NewUserSessionStore ¶
func NewUserSessionStore(fs ...UserSessionStoreOpt) (*UserSessionStore, error)
func (*UserSessionStore) Get ¶
Get Fetches a session for a given name after it has been added to the registry.
func (*UserSessionStore) GetName ¶
func (store *UserSessionStore) GetName() string
func (*UserSessionStore) MaxAge ¶
func (store *UserSessionStore) 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 (*UserSessionStore) MaxLength ¶
func (store *UserSessionStore) MaxLength(l int)
MaxLength restricts the maximum length of new sessions to l. If l is 0 there is no limit to the size of a session, use with caution. The default for a new PGStore is 4096. PostgreSQL allows for max value sizes of up to 1GB (http://www.postgresql.org/docs/current/interactive/datatype-character.html)
func (*UserSessionStore) Save ¶
func (store *UserSessionStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Save saves the given session into the database and deletes cookies if needed
type UserSessionStoreOpt ¶
type UserSessionStoreOpt func(*UserSessionStoreOpts)
func WithCookieAllowInsecure ¶
func WithCookieAllowInsecure(allow bool) UserSessionStoreOpt
func WithCookieDomain ¶
func WithCookieDomain(domain string) UserSessionStoreOpt
func WithCookieName ¶
func WithCookieName(name string) UserSessionStoreOpt
func WithCookieSecrets ¶
func WithCookieSecrets(secrets ...string) UserSessionStoreOpt
func WithSessionRepository ¶
func WithSessionRepository(repo repository.UserSessionRepository) UserSessionStoreOpt
type UserSessionStoreOpts ¶
type UserSessionStoreOpts struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.