Documentation ¶
Index ¶
Constants ¶
View Source
const ( // SessionCookieName is the name of the session cookie expected for authentication SessionCookieName = "jphotos_session" // ExpirationTime is the duration a session cookie is valid for once issued ExpirationTime = 7 * 24 * time.Hour // 1 week )
Variables ¶
View Source
var ( ErrInvalidUsernameOrPassword = errors.New("Invalid username or password") )
Error types returned by functions in auth
Functions ¶
Types ¶
type Authorization ¶
An Authorization represents a users' current authorization and authentication level
func Get ¶
Get returns a user's Authorization based on a session and a minimum required Role. If the session is valid, extend it.
func (Authorization) Revoke ¶
func (a Authorization) Revoke(db db.Store)
Revoke invalidates a session token in the database
type Role ¶
type Role int
A Role represents a user's maximum permission level
Permissions work as follows: - Invalid: Deactivated or otherwise invalid users - User: Normal users - SuperUser: Has all server permissions
Click to show internal directories.
Click to hide internal directories.