Versions in this module Expand all Collapse all v0 v0.1.0 Jun 16, 2017 Changes in this version + const RecoveryAdminName + const RecoveryPeriod + const SessionLifetime + var ErrAuthenticationFailed = errors.New("authentication failed, incorrect username or password") + var ErrPasswordTooCommon = errors.New("password is too common") + var ErrPasswordTooLong = fmt.Errorf("password exceeds maximum length %d", maxPasswordLength) + var ErrPasswordTooRepetitive = errors.New("password is too repetitive") + var ErrPasswordTooShort = fmt.Errorf("password does not meet minimum length %d", minPasswordLength) + var ErrUsernameTooLong = errors.New("username too long") + var ErrUsernameTooShort = errors.New("username too short") + func InitCommonPasswords(conf config.Config) error + func NewContext(ctx context.Context, u User) context.Context + func NewOwnerContext(ctx context.Context, u User) context.Context + func RecoveryMode() (string, error) + func ValidatePassword(password string) error + func ValidateUsername(name string) error + type AccessLevel uint8 + const LevelAdmin + const LevelAnon + const LevelGuest + const LevelRecovery + const LevelUser + func ParseAccessLevel(in string) AccessLevel + func (al AccessLevel) String() string + type Password struct + Hash []byte + Salt []byte + Version uint8 + func NewPassword(password string) (*Password, error) + func RandomPassword(length int) (string, *Password, error) + func (p Password) NeedsUpdate() bool + func (p Password) Verify(input string) (bool, error) + type Session struct + Expires time.Time + ID uuid.UUID + Key *Password + Secret string + UserID uuid.UUID + type User struct + Access AccessLevel + DisplayName string + ID uuid.UUID + Password *Password + Sessions []*Session + Username string + func AuthenticateAdmin(password string) (User, error) + func FromContext(ctx context.Context) (User, bool) + func New(username string) User + func OwnerFromContext(ctx context.Context) (User, bool) + func (u *User) CleanSessions() + func (u *User) NewSession() (session Session, err error) + func (u *User) ValidateSession(sessID uuid.UUID, key string) bool