- java.lang.Object
-
- controllers.AuthController
-
public class AuthController extends java.lang.ObjectTheAuthControllerclass provides utility methods for managing user authentication within the application. It offers methods to start and end user sessions, as well as handle user login and logout. This class utilizes theIAuthServiceinterface for handling the authentication process.
-
-
Field Summary
Fields Modifier and Type Field Description private static IAuthServiceauthServiceIAuthServiceobject to authenticate the user.private static java.util.ScannerscScannerobject to get input from the user.
-
Constructor Summary
Constructors Modifier Constructor Description privateAuthController()Private constructor to prevent instantiation of the class.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidendSession()Ends the current user session by logging the user out and displaying a logout message.static voidstartSession()Starts a user session by prompting the user to select their role and enter their credentials.
-
-
-
Field Detail
-
sc
private static final java.util.Scanner sc
Scannerobject to get input from the user.
-
authService
private static IAuthService authService
IAuthServiceobject to authenticate the user.
-
-
Method Detail
-
startSession
public static void startSession()
Starts a user session by prompting the user to select their role and enter their credentials. The method loops until valid credentials are provided or the system is shut down.
-
endSession
public static void endSession()
Ends the current user session by logging the user out and displaying a logout message.
-
-