- java.lang.Object
-
- controllers.AuthController
-
public class AuthController extends java.lang.Object
TheAuthController
class 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 theIAuthService
interface for handling the authentication process.
-
-
Field Summary
Fields Modifier and Type Field Description private static IAuthService
authService
IAuthService
object to authenticate the user.private static java.util.Scanner
sc
Scanner
object to get input from the user.
-
Constructor Summary
Constructors Modifier Constructor Description private
AuthController()
Private constructor to prevent instantiation of the class.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
endSession()
Ends the current user session by logging the user out and displaying a logout message.static void
startSession()
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
Scanner
object to get input from the user.
-
authService
private static IAuthService authService
IAuthService
object 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.
-
-