Documentation ¶
Index ¶
- Constants
- type Auth
- func (a *Auth) Authenticate(username, password string) (*User, error)
- func (a *Auth) CreateUser(username, userType string) (string, error)
- func (a *Auth) Delete(username string) error
- func (a *Auth) Get(username string) (*User, error)
- func (a *Auth) ResetPassword(username string) (string, error)
- func (a *Auth) SetPassword(username, password string) error
- func (a *Auth) Users() map[string]*User
- type User
Constants ¶
const ( NoUser = "" StandardUser = "standard" StaffUser = "staff" AdminUser = "admin" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth manages access to users. This includes adding and removing users. Only staff can change settings and only the administrator can perform user actions.
func New ¶
New creates a new authenticator for registered users. A special entry is created for the admin user.
func (*Auth) Authenticate ¶
Authenticate attempts to authenticate the specified using their username and password. To make things harder for malicious users, there is no distinguishing between invalid usernames and invalid passwords.
func (*Auth) CreateUser ¶
CreateUser creates a new user. Their randomly-generated password is returned if the process completes without error.
func (*Auth) ResetPassword ¶
ResetPassword attempts to reset a user's password.
func (*Auth) SetPassword ¶
SetPassword attempts to set a new password for a user.