AuthInterceptor class
Authentication interceptor for NetGuard with improved queue management and refresh token cooldown
- Inheritance
-
- Object
- Interceptor
- QueuedInterceptor
- AuthInterceptor
Constructors
- AuthInterceptor({required AuthCallbacks callbacks, AuthConfig config = const AuthConfig(), Dio? dio})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isRefreshing → bool
-
Check if token refresh is currently in progress
no setter
- lastLogoutTime → DateTime?
-
Get the time when logout was last triggered (null if never triggered)
no setter
- lastRefreshResult → _RefreshResult?
-
Get the last refresh result (null if no refresh has been attempted)
no setter
- lastRefreshTime → DateTime?
-
Get the time when refresh token was last triggered (null if never triggered)
no setter
- logoutCooldownRemaining → Duration?
-
Get remaining cooldown time for logout (null if no cooldown active)
no setter
- queuedRequestsCount → int
-
Get number of queued auth requests (useful for debugging)
no setter
- refreshTokenCooldownRemaining → Duration?
-
Get remaining cooldown time for refresh token (null if no cooldown active)
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → void - Clear any pending state (useful for testing or cleanup)
-
forceLogout(
) → Future< void> - Force logout and clear all authentication state (useful for manual logout)
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onError(
DioException err, ErrorInterceptorHandler handler) → void -
Called when an exception was occurred during the request.
override
-
onRequest(
RequestOptions options, RequestInterceptorHandler handler) → void -
Called when the request is about to be sent.
override
-
onResponse(
Response response, ResponseInterceptorHandler handler) → void -
Called when the response is about to be resolved.
override
-
resetLogoutCooldown(
) → void - Manually reset logout cooldown (useful for testing or specific scenarios)
-
resetRefreshTokenCooldown(
) → void - Manually reset refresh token cooldown (useful for testing or specific scenarios)
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited