Documentation ¶
Overview ¶
Package usersession contains the logic for usersession handling. This includes the usersession handling, the sign-in and the sign-out.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSigninHandler ¶
NewSigninHandler creates a new signin handler that handles signin requests from the client.
func NewSignoutHandler ¶
NewSignoutHandler creates a new signout handler that handles signout requests from the client.
Types ¶
type Auth ¶
type Auth interface { // Validate validates user credentials and returns the corresponding user. // // If the credentials are invalid false and nil(for user and error) will be // returned. // // If a real error happens during validation it will be returned and the // user will be nil and the bool false. Validate(identifier string, password string) (*user.User, bool, error) }
Auth is used to authenticate users.
type Handler ¶
type Handler interface { // StartFor starts the session for given user. StartFor(w http.ResponseWriter, r *http.Request, u *user.User) error // EndFor ends the session for given user. EndFor(w http.ResponseWriter, r *http.Request, u *user.User) error // GetCurrent gets the user that hold the session. If there is no // user session the returned user will be nil. GetCurrent(r *http.Request) (*user.User, error) }
Handler is used to start sessions for a user and end them.
Click to show internal directories.
Click to hide internal directories.