public abstract class AbstractAuthenticator extends Object implements Authenticator
Modifier and Type | Field and Description |
---|---|
protected static String |
USER
Key for user in session
|
Constructor and Description |
---|
AbstractAuthenticator() |
Modifier and Type | Method and Description |
---|---|
void |
clearCurrent()
Clears the current User.
|
boolean |
exists(String accountName)
Determine if the account exists.
|
User |
getCurrentUser()
Returns the currently logged in User.
|
protected DefaultUser |
getUserFromRememberToken()
Returns the user if a matching remember token is found, or null if the token
is missing, token is corrupt, token is expired, account name does not match
and existing account, or hashed password does not match user's hashed password.
|
protected User |
getUserFromSession()
Gets the user from session.
|
User |
login()
Calls login with the *current* request and response.
|
User |
login(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
This method should be called for every HTTP request, to login the current user either from the session of HTTP
request.
|
void |
logout()
Logs out the current user.
|
void |
setCurrentUser(User user)
Sets the currently logged in User.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
changePassword, createUser, generateStrongPassword, generateStrongPassword, getUser, getUser, getUserNames, hashPassword, removeUser, verifyAccountNameStrength, verifyPassword, verifyPasswordStrength
protected static final String USER
public void clearCurrent()
clearCurrent
in interface Authenticator
public boolean exists(String accountName)
exists
in interface Authenticator
accountName
- the account namepublic User getCurrentUser()
getCurrentUser
in interface Authenticator
protected User getUserFromSession()
protected DefaultUser getUserFromRememberToken()
public User login() throws AuthenticationException
login
in interface Authenticator
User
if login is successful.AuthenticationException
HTTPUtilities.setCurrentHTTP(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
public User login(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws AuthenticationException
login
in interface Authenticator
request
- the current HTTP requestresponse
- the HTTP responseAuthenticationException
- if the credentials are not verified, or if the account is disabled, locked, expired, or timed outpublic void logout()
logout
in interface Authenticator
public void setCurrentUser(User user)
setCurrentUser
in interface Authenticator
user
- the user to set as the current userCopyright © 2022 The Open Web Application Security Project (OWASP). All rights reserved.