Class SessionManager

java.lang.Object
util.SessionManager

public class SessionManager extends Object
Class that manages current user session for the application. Has methods that keep track of if a user is signed in or not. Only one user can be signed in at a time.
  • Constructor Details

    • SessionManager

      public SessionManager()
  • Method Details

    • signIn

      public static void signIn(User user)
      Signs in a user. Stores the user as the current session holder.
      Parameters:
      user - the user to sign in
    • signOut

      public static void signOut()
      Signs out current user by clearing session.
    • isSignedIn

      public static boolean isSignedIn()
      Method returns boolean value on whether a user is signed in.
      Returns:
      false if user is not signed in, true if signed in.
    • getSignedInUser

      public static User getSignedInUser()
      Method that returns the current user that the session contains.
      Returns:
      the current user