Module sc2002_fypms
Package stores

Class AuthStore


  • public class AuthStore
    extends java.lang.Object
    The AuthStore class provides utility methods for managing the current authenticated user within the application. It offers methods to set and get the current user, as well as check if the user is logged in.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static User currentUser
      The currently authenticated user.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private AuthStore()
      Private constructor to prevent instantiation of the class.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static User getCurrentUser()
      Gets the current user from the AuthStore.
      static boolean isLoggedIn()
      Checks if the user is logged in.
      static void setCurrentUser​(User currentUser)
      Sets the current user in the AuthStore.
      • Methods inherited from class java.lang.Object

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

      • currentUser

        private static User currentUser
        The currently authenticated user.
    • Constructor Detail

      • AuthStore

        private AuthStore()
        Private constructor to prevent instantiation of the class.
    • Method Detail

      • setCurrentUser

        public static void setCurrentUser​(User currentUser)
        Sets the current user in the AuthStore.
        Parameters:
        currentUser - the User instance to set as the current user
      • isLoggedIn

        public static boolean isLoggedIn()
        Checks if the user is logged in.
        Returns:
        true if the user is logged in, false otherwise
      • getCurrentUser

        public static User getCurrentUser()
        Gets the current user from the AuthStore.
        Returns:
        the current User instance, or null if not logged in