Documentation
¶
Index ¶
- func Enable()
- type CookieSession
- func (s *CookieSession) AddFlashError(msg string)
- func (s *CookieSession) AddFlashNotice(msg string)
- func (s *CookieSession) Clear() error
- func (s *CookieSession) CsrfToken() string
- func (s *CookieSession) FlashErrors() []string
- func (s *CookieSession) FlashNotices() []string
- func (s *CookieSession) Save() error
- func (s *CookieSession) SetUserId(id int)
- func (s *CookieSession) UserId() int
- type CookieSessionStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enable ¶
func Enable()
Initialize the session store with authentication and encryption keys.
Keys are read from the environment variables SESSION_AUTH_KEY and SESSION_ENCRYPTION_KEY If not set, temporary keys will be used.
Using temporary keys will invalidate all sessions when the server restarts.
Types ¶
type CookieSession ¶
type CookieSession struct {
// contains filtered or unexported fields
}
func (*CookieSession) AddFlashError ¶
func (s *CookieSession) AddFlashError(msg string)
func (*CookieSession) AddFlashNotice ¶
func (s *CookieSession) AddFlashNotice(msg string)
func (*CookieSession) Clear ¶
func (s *CookieSession) Clear() error
func (*CookieSession) CsrfToken ¶
func (s *CookieSession) CsrfToken() string
Returns existing CsrfToken from cookie or creates and saves a new token. Will panic if it is unable to return a token.
func (*CookieSession) FlashErrors ¶
func (s *CookieSession) FlashErrors() []string
func (*CookieSession) FlashNotices ¶
func (s *CookieSession) FlashNotices() []string
func (*CookieSession) Save ¶
func (s *CookieSession) Save() error
func (*CookieSession) SetUserId ¶
func (s *CookieSession) SetUserId(id int)
func (*CookieSession) UserId ¶
func (s *CookieSession) UserId() int
type CookieSessionStore ¶
type CookieSessionStore struct{}
func (CookieSessionStore) Session ¶
func (store CookieSessionStore) Session(res http.ResponseWriter, req *http.Request) handlers.Session
Click to show internal directories.
Click to hide internal directories.