WaAuthController<T> class abstract

The WaAuthController is an abstract class that defines authentication and authorization methods for a web application.

This controller handles common tasks like login, registration, authentication checks, and user session management. It extends the WaController and provides methods that can be overridden to customize authentication logic.

The type parameter T represents the user model or object being used in the authentication process.

Inheritance

Constructors

WaAuthController(WebRequest rq)
Constructs a WaAuthController with the given request object.

Properties

hashCode int
The hash code for this object.
no setterinherited
rq WebRequest
The WebRequest object representing the current web request.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

auth() Future<bool>
Checks if a user is authenticated.
authApi() Future<bool>
Checks if the current API request is authenticated.
checkLogin() Future<({String message, bool success, T? user})>
Checks the login status and returns a tuple containing the success status, a message, and the authenticated user object T.
checkPermission() Future<bool>
Checks if the current user has permission to access specific resources.
index() Future<String>
Displays the main page after authentication.
override
loginPost() Future<String>
Handles the logic for user login with a POST request.
logout() Future<String>
Logs out the current user and clears the session.
newUser() Future<String>
Creates a new user account.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register() Future<String>
Handles the logic for user registration.
removeAuth() → void
Removes the authentication session, effectively logging out the user.
toString({dynamic short = false}) String
Returns a string representation of the controller.
inherited
updateAuth(String email, String password, T user) → void
Updates the authentication session with the provided email, password, and user object T.

Operators

operator ==(Object other) bool
The equality operator.
inherited