- java.lang.Object
-
- services.AuthService
-
- All Implemented Interfaces:
IAuthService
- Direct Known Subclasses:
AuthStaffService
,AuthStudentService
public abstract class AuthService extends java.lang.Object implements IAuthService
AuthService
is an abstract class that implements theIAuthService
interface. It provides authentication functions for login and logout.
-
-
Constructor Summary
Constructors Constructor Description AuthService()
Constructs an instance of theAuthService
class.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
authenticate(User user, java.lang.String password)
Authenticates the given user with the given password.abstract boolean
login(java.lang.String userID, java.lang.String password)
Logs in a user with userID and password (for student and staff)boolean
logout()
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 theAuthService
class.
-
-
Method Detail
-
login
public abstract boolean login(java.lang.String userID, java.lang.String password)
Description copied from interface:IAuthService
Logs in a user with userID and password (for student and staff)- Specified by:
login
in interfaceIAuthService
- Parameters:
userID
- user's userIDpassword
- user's password- Returns:
True
if the user is authenticated successfully,False
otherwise
-
logout
public boolean logout()
Description copied from interface:IAuthService
Logs out the currently logged in user.- Specified by:
logout
in interfaceIAuthService
- Returns:
True
if successfully log out,False
otherwise.
-
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
-
-