Package Components

Class Authentication


  • public final class Authentication
    extends java.lang.Object
    Authentication class for authenticating username and password for each user
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Authentication()
      Private constructor to hinder creation of utility class
    • Method Summary

      Modifier and Type Method Description
      static boolean deleteUser​(java.lang.String username, java.lang.String password, boolean confirmation)
      Deletes the current logged in user will compare password from db to the entered password
      static boolean isCurrentUser​(java.lang.String username, java.lang.String password)
      Checks if a user with a username and password is the current user logged in
      static boolean logIn​(java.lang.String username, java.lang.String password)
      LogIn method is used when the user is trying to log in will compare password from db to the entered password
      static LoginRoot logout()
      Log out the user and redirect to login scene
      static boolean register​(java.lang.String username, java.lang.String password)
      Register a new user It will encrypt the password before inserting into database
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Authentication

        private Authentication()
        Private constructor to hinder creation of utility class
    • Method Detail

      • register

        public static boolean register​(java.lang.String username,
                                       java.lang.String password)
        Register a new user It will encrypt the password before inserting into database
        Parameters:
        username - the username
        password - the password
        Returns:
        if method was successful
      • logIn

        public static boolean logIn​(java.lang.String username,
                                    java.lang.String password)
        LogIn method is used when the user is trying to log in will compare password from db to the entered password
        Parameters:
        username - of user
        password - of user
        Returns:
        if login was successful
      • isCurrentUser

        public static boolean isCurrentUser​(java.lang.String username,
                                            java.lang.String password)
        Checks if a user with a username and password is the current user logged in
        Parameters:
        username - of user
        password - of user
        Returns:
        if this user is the current user
      • deleteUser

        public static boolean deleteUser​(java.lang.String username,
                                         java.lang.String password,
                                         boolean confirmation)
        Deletes the current logged in user will compare password from db to the entered password
        Parameters:
        username - of user
        password - of user
        confirmation - if the user confirmed to delete the user
        Returns:
        if deleting the user was successful
      • logout

        public static LoginRoot logout()
        Log out the user and redirect to login scene
        Returns:
        loginRoot the root the user is sent to