- java.lang.Object
-
- services.AuthService
-
- All Implemented Interfaces:
IAuthService
- Direct Known Subclasses:
AuthStaffService,AuthStudentService
public abstract class AuthService extends java.lang.Object implements IAuthService
AuthServiceis an abstract class that implements theIAuthServiceinterface. It provides authentication functions for login and logout.
-
-
Constructor Summary
Constructors Constructor Description AuthService()Constructs an instance of theAuthServiceclass.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleanauthenticate(User user, java.lang.String password)Authenticates the given user with the given password.abstract booleanlogin(java.lang.String userID, java.lang.String password)Logs in a user with userID and password (for student and staff)booleanlogout()Logs out the currently logged in user.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface interfaces.IAuthService
login
-
-
-
-
Constructor Detail
-
AuthService
public AuthService()
Constructs an instance of theAuthServiceclass.
-
-
Method Detail
-
login
public abstract boolean login(java.lang.String userID, java.lang.String password)Description copied from interface:IAuthServiceLogs in a user with userID and password (for student and staff)- Specified by:
loginin interfaceIAuthService- Parameters:
userID- user's userIDpassword- user's password- Returns:
Trueif the user is authenticated successfully,Falseotherwise
-
logout
public boolean logout()
Description copied from interface:IAuthServiceLogs out the currently logged in user.- Specified by:
logoutin interfaceIAuthService- Returns:
Trueif successfully log out,Falseotherwise.
-
authenticate
protected boolean authenticate(User user, java.lang.String password)
Authenticates the given user with the given password.- Parameters:
user- the user to be authenticatedpassword- the password to be used for authentication- Returns:
- true if the user is authenticated successfully, false otherwise
-
-