userManager.authenticate
Class Authenticate

java.lang.Object
  extended by userManager.authenticate.Authenticate
All Implemented Interfaces:
AuthenticateInterface

public class Authenticate
extends Object
implements AuthenticateInterface

The Authenticate class provides functions for user to login and logout of the system. After authenticating the user, class will add user into the Active table where users remain until the logout.


Field Summary
 ActiveInterface active
           
 Builder build
           
 UserInterface user
           
 
Method Summary
 boolean authenticate(String username, String password)
          This method will verify that a given username and password matches a registered user in the system.
static Authenticate getInstance()
          This method will return the Authenticate instance if one already exists.
 void logout(String username)
          This method will logout the user from the system by removing it from active users table and marks user status field as 0 for inactive.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

active

public ActiveInterface active

user

public UserInterface user

build

public Builder build
Method Detail

getInstance

public static Authenticate getInstance()
This method will return the Authenticate instance if one already exists. If the Authenticate class instance doesnot exists, method will construct the class and return its instance.


authenticate

public boolean authenticate(String username,
                            String password)
This method will verify that a given username and password matches a registered user in the system. If a match is found it returns true, else, it returns false. If it returns true, the method will construct a User object and adds it to ActiveInterface table.

Specified by:
authenticate in interface AuthenticateInterface
Parameters:
String - userName username value to be authenticated.
String - password password value to be authenticated.
Returns:
Boolean Authentication result.

logout

public void logout(String username)
This method will logout the user from the system by removing it from active users table and marks user status field as 0 for inactive.

Specified by:
logout in interface AuthenticateInterface