public abstract class Authenticator extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Authenticator.AuthenticatorFactory |
static class |
Authenticator.LoginNotPermitted |
| Modifier and Type | Field and Description |
|---|---|
static int |
LOGGED_IN_TIMEOUT_INTERVAL
Maximum inactive interval for a ordinary logged-in session, in seconds.
|
static int |
PRIVILEGED_TIMEOUT_INTERVAL
Maximum inactive interval for a editor (or better) session, in seconds.
|
| Constructor and Description |
|---|
Authenticator() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
accountRequiresEditing(UserAccount userAccount)
Is a change in name or email required when the user logs in?
|
static String |
applyArgon2iEncoding(String raw)
Applies Argon2i hashing on a string.
|
static String |
applyMd5Encoding(String raw)
Apply MD5 to this string, and encode as a string of hex digits.
|
abstract UserAccount |
getAccountForExternalAuth(String externalAuthId)
Get the UserAccount for this external ID, or null if there is none.
|
abstract UserAccount |
getAccountForInternalAuth(String emailAddress)
Get the UserAccount for this email address, or null if there is none.
|
abstract List<String> |
getAssociatedIndividualUris(UserAccount userAccount)
Get the URIs of all individuals associated with this user, whether by a
self-editing property like cornellEmailNetid, or by mayEditAs.
|
static IdentifierBundle |
getIdsForUserAccount(javax.servlet.http.HttpServletRequest req,
UserAccount userAccount)
Get the IDs that would be created for this userAccount, if this user were
to log in.
|
static Authenticator |
getInstance(javax.servlet.http.HttpServletRequest request)
Ask the currently configured AuthenticatorFactory to give us an
Authenticator for this request.
|
abstract boolean |
isCurrentPassword(UserAccount userAccount,
String clearTextPassword)
Internal: does this UserAccount have this password? False if the
userAccount is null.
|
abstract boolean |
isCurrentPasswordArgon2(UserAccount userAccount,
String clearTextPassword)
Does this UserAccount have this Argon2 password? False if the
userAccount is null.
|
abstract boolean |
isUserPermittedToLogin(UserAccount userAccount)
Is this user permitted to login? Some Authenticators might disable logins
for certain users.
|
static boolean |
isValidEmailAddress(String emailAddress)
Check whether the form of the emailAddress is syntactically correct.
|
abstract boolean |
md5HashIsNull(UserAccount userAccount)
Checks if the user still has got an MD5 Password
|
abstract void |
recordLoginAgainstUserAccount(UserAccount userAccount,
LoginStatusBean.AuthenticationSource authSource)
Record that the user has logged in, with all of the housekeeping that
goes with it:
- update the user record
- set login status and timeout limit in the session
- refresh the Identifiers on the request
- record the user in the session map
- notify other users of the model
|
abstract void |
recordNewPassword(UserAccount userAccount,
String newClearTextPassword)
Internal: record a new password for the user.
|
abstract void |
recordUserIsLoggedOut()
Record that the current user has logged out: - notify other users of the
model.
|
static void |
setAuthenticatorFactory(Authenticator.AuthenticatorFactory factory,
javax.servlet.ServletContext ctx) |
static boolean |
verifyArgon2iHash(String hash,
String raw)
Verifies the string against the Argon2i hash stored for a user account
|
public static final int LOGGED_IN_TIMEOUT_INTERVAL
public static final int PRIVILEGED_TIMEOUT_INTERVAL
public static Authenticator getInstance(javax.servlet.http.HttpServletRequest request)
public static void setAuthenticatorFactory(Authenticator.AuthenticatorFactory factory, javax.servlet.ServletContext ctx)
public abstract UserAccount getAccountForExternalAuth(String externalAuthId)
public abstract UserAccount getAccountForInternalAuth(String emailAddress)
public abstract boolean isUserPermittedToLogin(UserAccount userAccount)
public abstract boolean isCurrentPassword(UserAccount userAccount, String clearTextPassword)
public abstract boolean isCurrentPasswordArgon2(UserAccount userAccount, String clearTextPassword)
public abstract boolean md5HashIsNull(UserAccount userAccount)
public abstract void recordNewPassword(UserAccount userAccount, String newClearTextPassword)
public abstract boolean accountRequiresEditing(UserAccount userAccount)
public abstract List<String> getAssociatedIndividualUris(UserAccount userAccount)
public abstract void recordLoginAgainstUserAccount(UserAccount userAccount, LoginStatusBean.AuthenticationSource authSource) throws Authenticator.LoginNotPermitted
Record that the user has logged in, with all of the housekeeping that goes with it: - update the user record - set login status and timeout limit in the session - refresh the Identifiers on the request - record the user in the session map - notify other users of the model
Authenticator.LoginNotPermitted - if the Authenticator denies this user the ability to login.
This should be thrown if and only if isUserPermittedToLogin()
returns false.public abstract void recordUserIsLoggedOut()
Record that the current user has logged out: - notify other users of the model. - invalidate the session.
public static String applyMd5Encoding(String raw)
public static String applyArgon2iEncoding(String raw)
public static boolean verifyArgon2iHash(String hash, String raw)
public static boolean isValidEmailAddress(String emailAddress)
public static IdentifierBundle getIdsForUserAccount(javax.servlet.http.HttpServletRequest req, UserAccount userAccount)
Copyright © 2021. All rights reserved.