public class AuthFacade extends Facade
| Constructor and Description |
|---|
AuthFacade(DAOFactory daoFactory,
PasswordAlgorithm passAlgo,
Session session) |
| Modifier and Type | Method and Description |
|---|---|
Client |
getLoggedInClient() |
StaffMember |
getLoggedInStaff() |
java.lang.String |
hashPassword(java.lang.String plainTextPassword) |
void |
loginClient(java.lang.String cardId)
Tries to connect a client with the given card ID.
|
void |
loginStaff(java.lang.String username,
java.lang.String password)
Tries to login a staff member which has the given username and the given password.
|
void |
logout()
Logs out the currently logged in user of the system.
|
void |
setLoggedInStaff(StaffMember member) |
public AuthFacade(DAOFactory daoFactory, PasswordAlgorithm passAlgo, Session session)
daoFactory - The factory to use to access users datapassAlgo - The password hashing algorithm to use to check users passwordssession - The session to change the state of when a method of the facade succeedspublic void loginStaff(java.lang.String username,
java.lang.String password)
throws BadCredentialsException,
InternalException
username - the username of the staff member to log inpassword - the plain password of the staff member to log inBadCredentialsException - when no staff member with the given username can be found
or that the given password is invalid for the staff member
with the given usernameInternalException - when an expected error occurredpublic void loginClient(java.lang.String cardId)
throws BadCredentialsException,
InternalException
cardId - the card ID of the client to login to the systemBadCredentialsException - if no client with the given card ID can be foundInternalException - when an expected error occurredpublic void logout()
public StaffMember getLoggedInStaff()
public void setLoggedInStaff(StaffMember member)
public Client getLoggedInClient()
public java.lang.String hashPassword(java.lang.String plainTextPassword)