Module sc2002_fypms
Package controllers

Class AuthController


  • public class AuthController
    extends java.lang.Object
    The AuthController 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 the IAuthService 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • sc

        private static final java.util.Scanner sc
        Scanner object to get input from the user.
    • Constructor Detail

      • AuthController

        private AuthController()
        Private constructor to prevent instantiation of the class.
    • 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.