JwtConfig class

Configuration options for the JWT authentication module.

Implemented types

Constructors

JwtConfig({required JwtAlgorithm algorithm, required String refreshTokenHashPepper, List<String> fallbackRefreshTokenHashPeppers = const [], List<JwtAlgorithm> fallbackVerificationAlgorithms = const [], Duration accessTokenLifetime = const Duration(minutes: 10), Duration refreshTokenLifetime = const Duration(days: 14), String? issuer, int refreshTokenFixedSecretLength = 16, int refreshTokenRotatingSecretLength = 64, int refreshTokenRotatingSecretSaltLength = 16, Future<Map<String, dynamic>?> extraClaimsProvider(Session session, JwtContext context)?, Future<void> onRefreshTokenCreated(Session session, {required UuidValue authUserId, required UuidValue refreshTokenId, required Transaction? transaction})?})
Create a new user profile configuration.

Properties

accessTokenLifetime → Duration
The lifetime of access tokens.
final
algorithm → JwtAlgorithm
The algorithm used to sign and verify the JWT tokens.
final
extraClaimsProvider → Future<Map<String, dynamic>?> Function(Session session, JwtContext context)?
Optional provider for extra claims to add to refresh tokens.
final
fallbackRefreshTokenHashPeppers → List<String>
Optional fallback peppers for validating refresh tokens created with previous peppers.
final
fallbackVerificationAlgorithms → List<JwtAlgorithm>
The algorithms used to verify the JWT tokens in case the primary algorithm fails. These are tried in order until one succeeds or all fail.
final
hashCode → int
The hash code for this object.
no setterinherited
issuer → String?
The issuer set on the JWT access tokens.
final
onRefreshTokenCreated → Future<void> Function(Session session, {required UuidValue authUserId, required UuidValue refreshTokenId, required Transaction? transaction})?
Called when a refresh token has been created.
final
refreshTokenFixedSecretLength → int
The amount of random bytes used for the fixed secret part of each individual refresh token.
final
refreshTokenHashPepper → String
Pepper used for hashing refresh tokens.
final
refreshTokenLifetime → Duration
The lifetime of a refresh token.
final
refreshTokenRotatingSecretLength → int
The amount of random bytes used for the rotating secret of the refresh token.
final
refreshTokenRotatingSecretSaltLength → int
The amount of random bytes used to hash the rotation secret of the refresh token with.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

build({required AuthUsers authUsers}) → JwtTokenManager
Builds a new instance of the token manager.
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