TokenAuthenticator class

Authenticates TokenCredentials against an in-memory token store.

Tokens are matched in constant time (per candidate) to avoid leaking their length/prefix through timing. Token secrecy in transit is provided by TLS. The presented credential's principal must match the principal the token was issued for.

Implemented types

Constructors

TokenAuthenticator(Map<String, TokenGrant> tokens)
Creates a token authenticator from a tokens map (token → grant).

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addToken(String token, TokenGrant grant) → void
Registers or replaces a token for grant.
authenticate(Credential credential, {required Uint8List challenge}) Future<Principal>
Authenticates credential, returning the resolved Principal.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited