Package Components
Class Authentication
- java.lang.Object
-
- Components.Authentication
-
public final class Authentication extends java.lang.ObjectAuthentication class for authenticating username and password for each user
-
-
Constructor Summary
Constructors Modifier Constructor Description privateAuthentication()Private constructor to hinder creation of utility class
-
Method Summary
Modifier and Type Method Description static booleandeleteUser(java.lang.String username, java.lang.String password, boolean confirmation)Deletes the current logged in user will compare password from db to the entered passwordstatic booleanisCurrentUser(java.lang.String username, java.lang.String password)Checks if a user with a username and password is the current user logged instatic booleanlogIn(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 passwordstatic LoginRootlogout()Log out the user and redirect to login scenestatic booleanregister(java.lang.String username, java.lang.String password)Register a new user It will encrypt the password before inserting into database
-
-
-
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 usernamepassword- 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 userpassword- 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 userpassword- 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 userpassword- of userconfirmation- 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
-
-