Documentation
¶
Index ¶
- Variables
- func HashPassword(value string) (string, error)
- func NormalizeUsername(value string) string
- func ValidatePassword(value string) error
- func ValidateRole(role string) error
- func ValidateUsername(value string) error
- type Config
- type LoginLimiter
- type Service
- func (s *Service) Authenticate(ctx context.Context, token string) (model.User, error)
- func (s *Service) ClearSessionCookie(w http.ResponseWriter)
- func (s *Service) EnsureBootstrapAdmin(ctx context.Context, username, password string) error
- func (s *Service) Login(ctx context.Context, username, password string) (model.User, string, time.Time, error)
- func (s *Service) Logout(ctx context.Context, token string) error
- func (s *Service) SetSessionCookie(w http.ResponseWriter, token string, expiresAt time.Time)
- func (s *Service) TokenFromRequest(r *http.Request) string
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidCredentials = errors.New("invalid username or password")
Functions ¶
func HashPassword ¶
func NormalizeUsername ¶
func ValidatePassword ¶
func ValidateRole ¶
func ValidateUsername ¶
Types ¶
type LoginLimiter ¶
type LoginLimiter struct {
// contains filtered or unexported fields
}
func NewLoginLimiter ¶
func NewLoginLimiter() *LoginLimiter
func (*LoginLimiter) Failure ¶
func (l *LoginLimiter) Failure(key string)
func (*LoginLimiter) Success ¶
func (l *LoginLimiter) Success(key string)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Authenticate ¶
func (*Service) ClearSessionCookie ¶
func (s *Service) ClearSessionCookie(w http.ResponseWriter)
func (*Service) EnsureBootstrapAdmin ¶
func (*Service) SetSessionCookie ¶
Click to show internal directories.
Click to hide internal directories.