Documentation ¶
Index ¶
Constants ¶
View Source
const ( // USER_SESSION_NAME is the name of the cookie containing the user session id USER_SESSION_NAME = common.APP_NAME_SHORT + "-ui-user" // SESSION_KEY_SESSION_INFO is the key used to store the session struct in the session store SESSION_KEY_SESSION_INFO = "session-info" )
Variables ¶
This section is empty.
Functions ¶
func IsLoggedIn ¶
IsLoggedIn checks if the user has logged in already
func SaveSession ¶
SaveSession updates the info of an existing session.
func SetupSessionStore ¶
func SetupSessionStore() error
SetupSessionStore sets up the session store.
Types ¶
type Session ¶
type Session struct { Id string `json:"id"` Tokens types.Tokens `json:"tokens"` User types.UserInfo `json:"user"` PostLoginRedirectPath string `json:"post_login_redirect_path"` }
Session contains data for a user session
func GetSession ¶
GetSession returns info about the session. It returns error if the session doesn't exist.
func NewSession ¶
NewSession creates a new session.
func (Session) GetCSRFToken ¶
GetCSRFToken returns a random string to use as the CSRF token based on the session
func (Session) IsValidCSRFToken ¶
IsValidCSRFToken checks the provided access token against the CSRF token generated from the session
func (*Session) RefreshUserTokensIfExpired ¶
RefreshUserTokensIfExpired refreshs the user token if it has expired
Click to show internal directories.
Click to hide internal directories.