AuthController<T> class
abstract
The AuthController 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 Controller 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
-
- Object
- Controller
- AuthController
Constructors
- AuthController()
-
Constructs a
AuthController.
Properties
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(
{bool 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