Guard class abstract
Base authentication guard
Guards handle authentication for different contexts (web, api, etc.). They use drivers to perform low-level token operations and repositories for user data access.
Constructors
- Guard({required AuthConfig config, required AuthDriver driver, required String providerKey, AuthRepository? repository, PasswordVerifier? passwordVerifier})
- Creates a base guard
Properties
- config → AuthConfig
-
Authentication configuration
final
- driver → AuthDriver
-
The authentication driver
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- passwordVerifier → PasswordVerifier
-
Password verifier
final
- providerKey → String
-
The provider key
final
- repository → AuthRepository
-
Authentication repository
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
attempt(
Map< String, dynamic> credentials) → Future<AuthResponse> - Attempts to authenticate a user with credentials
-
check(
String token) → Future< bool> - Checks if a token is valid
-
login(
Authenticatable user) → Future< AuthResponse> - Authenticates a user directly (without password check)
-
logout(
String token) → Future< void> - Logs out a user by invalidating their token
-
logoutAll(
dynamic token) → Future< void> - Logs out the user from all devices (invalidates all tokens)
-
logoutOthers(
dynamic userId, String currentToken) → Future< void> - Logs out the user from other devices (invalidates all tokens except current)
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refresh(
String refreshToken) → Future< AuthResponse> - Refreshes an access token
-
toString(
) → String -
A string representation of this object.
inherited
-
user(
String token) → Future< Authenticatable> - Verifies an authentication token
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited