AuthConfig class
Configuration for AuthInterceptor.
Constructors
-
AuthConfig({String tokenHeaderName = 'Authorization', String tokenPrefix = 'Bearer ', int maxRetryAttempts = 1, Duration retryDelay = const Duration(milliseconds: 500), bool autoRefresh = true, bool proactiveRefresh = true, Duration refreshLeeway = const Duration(seconds: 30), bool enableLogging = false, Duration logoutCooldown = const Duration(minutes: 1), Duration refreshTokenCooldown = const Duration(seconds: 30), Set<
int> unauthorizedStatusCodes = const {401}}) -
const
Properties
- autoRefresh → bool
-
Refresh reactively when the server rejects a request.
final
- enableLogging → bool
-
Emit
[NetGuard Auth]diagnostics.final - hashCode → int
-
The hash code for this object.
no setterinherited
- logoutCooldown → Duration
-
Minimum spacing between logout callbacks, so a burst of rejected
requests triggers one logout rather than a dozen.
final
- maxRetryAttempts → int
-
How many times a refresh is attempted before giving up.
final
- proactiveRefresh → bool
-
Refresh before sending, when the current JWT is about to expire.
final
- refreshLeeway → Duration
-
How long before expiry a token is considered stale.
final
- refreshTokenCooldown → Duration
-
Minimum spacing between refresh attempts. Within this window the
previous outcome is reused.
final
- retryDelay → Duration
-
Delay between failed refresh attempts.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tokenHeaderName → String
-
Header the token is written to.
final
- tokenPrefix → String
-
Prefix placed before the token, e.g.
'Bearer '.final -
Status codes treated as "token rejected". Some APIs use 403.
final
Methods
-
copyWith(
{String? tokenHeaderName, String? tokenPrefix, int? maxRetryAttempts, Duration? retryDelay, bool? autoRefresh, bool? proactiveRefresh, Duration? refreshLeeway, bool? enableLogging, Duration? logoutCooldown, Duration? refreshTokenCooldown, Set< int> ? unauthorizedStatusCodes}) → AuthConfig - Copy with selected overrides.
-
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