Documentation
¶
Index ¶
- Constants
- type FailureLimiter
- type FailureLimiterOption
- type Option
- type PairingCode
- type Session
- type Store
- func (s *Store) ConsumePairingCode(code string) (PairingCode, bool, error)
- func (s *Store) CreatePairingCode(role string, ttl time.Duration) (PairingCode, error)
- func (s *Store) CreateSession(role, userAgentHint string, ttl time.Duration) (Session, error)
- func (s *Store) HasPassword(role string) (bool, error)
- func (s *Store) RevokeRoleSessions(role string) error
- func (s *Store) RevokeSession(id string) error
- func (s *Store) SetPassword(role, password string) error
- func (s *Store) ValidateSession(id string) (Session, bool, error)
- func (s *Store) VerifyPassword(role, password string) (bool, error)
- type UserRecord
Constants ¶
View Source
const ( FailurePurposeLogin = "login" FailurePurposePairing = "pairing" )
View Source
const ( RoleAdmin = "admin" RoleUser = "user" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FailureLimiter ¶
type FailureLimiter struct {
// contains filtered or unexported fields
}
func NewFailureLimiter ¶
func NewFailureLimiter(maxFailures int, lockout time.Duration, opts ...FailureLimiterOption) *FailureLimiter
func (*FailureLimiter) Allow ¶
func (l *FailureLimiter) Allow(purpose, role, remoteKey string) (bool, time.Time)
func (*FailureLimiter) RecordFailure ¶
func (l *FailureLimiter) RecordFailure(purpose, role, remoteKey string) time.Time
func (*FailureLimiter) RecordSuccess ¶
func (l *FailureLimiter) RecordSuccess(purpose, role, remoteKey string)
type FailureLimiterOption ¶
type FailureLimiterOption func(*FailureLimiter)
func WithLimiterNow ¶
func WithLimiterNow(now func() time.Time) FailureLimiterOption
type PairingCode ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) ConsumePairingCode ¶
func (s *Store) ConsumePairingCode(code string) (PairingCode, bool, error)
func (*Store) CreatePairingCode ¶
func (*Store) CreateSession ¶
func (*Store) RevokeRoleSessions ¶
func (*Store) RevokeSession ¶
func (*Store) SetPassword ¶
type UserRecord ¶
Click to show internal directories.
Click to hide internal directories.