Versions in this module Expand all Collapse all v0 v0.8.0 Oct 30, 2026 Changes in this version + const MaxSessions + const MaxThrottleClients + const SessionIdleTimeout + const SessionMaxLifetime + const TokenPrefix + var ErrUnauthenticated = errors.New("auth: unauthenticated") + func GenerateToken() (string, error) + type Authenticator interface + Authenticate func(r *http.Request) (Principal, error) + type DigestAuthenticator interface + AuthenticateDigest func(d [sha256.Size]byte) (Principal, error) + type Principal struct + Name string + Scope Scope + type Scope int + const Admin + const Eval + const Read + const Write + func (s Scope) Allows(required Scope) bool + func (s Scope) String() string + func (s Scope) Valid() bool + type Session struct + CSRF string + Created time.Time + Digest [sha256.Size]byte + Principal Principal + Seen time.Time + type SessionStore struct + func NewSessionStore(now func() time.Time) *SessionStore + func (s *SessionStore) Create(p Principal, digest [sha256.Size]byte) (string, error) + func (s *SessionStore) Delete(id string) + func (s *SessionStore) Get(id string) (Session, bool) + func (s *SessionStore) Len() int + type Static struct + func NewStatic(tokens map[Scope][]string) *Static + func (s *Static) Authenticate(r *http.Request) (Principal, error) + func (s *Static) AuthenticateDigest(d [sha256.Size]byte) (Principal, error) + type Throttle struct + func NewThrottle(now func() time.Time) *Throttle + func (t *Throttle) Check(key string) time.Duration + func (t *Throttle) Fail(key string) time.Duration + func (t *Throttle) Len() int + func (t *Throttle) Success(key string)