AuthManager class
Authentication manager
Constructors
- AuthManager({required String jwtSecret, Duration sessionDuration = const Duration(hours: 24), Duration jwtDuration = const Duration(hours: 1)})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- jwtDuration → Duration
-
final
- jwtSecret → String
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sessionDuration → Duration
-
final
Methods
-
changePassword(
{required String userId, required String currentPassword, required String newPassword}) → Future< AuthResult> - Change password
-
generatePasswordResetToken(
String email) → Future< AuthResult> - Generate password reset token
-
login(
{required String username, required String password}) → Future< AuthResult> - Login user
-
logout(
String sessionId) → Future< AuthResult> - Logout user
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refreshToken(
String token) → Future< AuthResult> - Refresh JWT token
-
register(
{required String username, required String email, required String password}) → Future< AuthResult> - Register a new user
-
resetPassword(
{required String email, required String resetToken, required String newPassword}) → Future< AuthResult> - Reset password with token
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited