public abstract class AbstractUsernamePasswordValidationAction extends AbstractValidationAction
UsernamePasswordContext and produces an
AuthenticationResult based on that identity by invoking
a subclass method.
Lockout behavior can be enabled by injecting an AccountLockoutManager
EventIds.PROCEED_EVENT_ID, AuthnEventIds.INVALID_CREDENTIALS, AuthnEventIds.NO_CREDENTIALS, AuthnEventIds.ACCOUNT_LOCKEDAuthenticationResult is saved to the AuthenticationContext on a
successful login. On a failed login, the
AbstractValidationAction.handleError(ProfileRequestContext, AuthenticationContext, Exception, String)
method is called.| Modifier and Type | Field and Description |
|---|---|
private static String |
DEFAULT_METRIC_NAME
Default prefix for metrics.
|
private AccountLockoutManager |
lockoutManager
Optional lockout management interface.
|
private org.slf4j.Logger |
log
Class logger.
|
private Pattern |
matchExpression
A regular expression to apply for acceptance testing.
|
private boolean |
removeContextAfterValidation
Whether to remove the
UsernamePasswordContext after successful validation. |
private boolean |
savePasswordToCredentialSet
Whether to save the password in the Java Subject's private credentials.
|
private UsernamePasswordContext |
upContext
UsernamePasswordContext containing the credentials to validate.
|
| Constructor and Description |
|---|
AbstractUsernamePasswordValidationAction()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
doPreExecute(ProfileRequestContext profileRequestContext,
AuthenticationContext authenticationContext)
Performs this authentication action's pre-execute step.
|
AccountLockoutManager |
getLockoutManager()
Get an account lockout management component.
|
UsernamePasswordContext |
getUsernamePasswordContext()
Get the
UsernamePasswordContext to validate. |
protected Subject |
populateSubject(Subject subject)
|
protected void |
recordFailure(ProfileRequestContext profileRequestContext,
boolean inc)
Record a failed authentication attempt against the configured counter,
optionally incrementing the account lockout counter.
|
protected void |
recordSuccess(ProfileRequestContext profileRequestContext)
Record a successful authentication attempt against the configured counter,
optionally clearing account lockout state.
|
boolean |
removeContextAfterValidation()
Get whether to remove the
UsernamePasswordContext after it's
successfully validated. |
boolean |
savePasswordToCredentialSet()
Get whether to save the password in the private credential set.
|
void |
setLockoutManager(AccountLockoutManager manager)
Set an account lockout management component.
|
void |
setMatchExpression(Pattern expression)
Set a matching expression to apply to the username for acceptance.
|
void |
setRemoveContextAfterValidation(boolean flag)
Set whether to remove the
UsernamePasswordContext after it's
successfully validated. |
void |
setSavePasswordToCredentialSet(boolean flag)
Set whether to save the password in the private credential set.
|
addDefaultPrincipals, buildAuthenticationResult, getClassifiedErrors, getMetricName, getResultCachingPredicate, getSubject, getSupportedPrincipals, handleError, handleError, handleWarning, recordFailure, recordSuccess, setAddDefaultPrincipals, setClassifiedMessages, setMetricName, setRequesterLookupStrategy, setResponderLookupStrategy, setResultCachingPredicate, setSupportedPrincipalsdoExecute, doExecute, doPreExecute, setLookupStrategydoExecute, execute, getMessage, getMessage, getMessage, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategygetActivationCondition, setActivationConditiondoPostExecute, doPostExecute, execute, getHttpServletRequest, getHttpServletResponse, getLogPrefix, setHttpServletRequest, setHttpServletResponsedestroy, doDestroy, doInitialize, initialize, isDestroyed, isInitializedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitialize, isInitialized@Nonnull @NotEmpty private static final String DEFAULT_METRIC_NAME
@Nonnull private final org.slf4j.Logger log
private boolean savePasswordToCredentialSet
private boolean removeContextAfterValidation
UsernamePasswordContext after successful validation.@Nullable private Pattern matchExpression
@Nullable private AccountLockoutManager lockoutManager
@Nullable private UsernamePasswordContext upContext
public AbstractUsernamePasswordValidationAction()
public boolean savePasswordToCredentialSet()
public void setSavePasswordToCredentialSet(boolean flag)
flag - flag to setpublic boolean removeContextAfterValidation()
UsernamePasswordContext after it's
successfully validated.
Defaults to true
public void setRemoveContextAfterValidation(boolean flag)
UsernamePasswordContext after it's
successfully validated.flag - flag to setpublic void setMatchExpression(@Nullable Pattern expression)
expression - a matching expression@Nullable public AccountLockoutManager getLockoutManager()
public void setLockoutManager(@Nullable AccountLockoutManager manager)
manager - lockout manager@Nullable public UsernamePasswordContext getUsernamePasswordContext()
UsernamePasswordContext to validate.protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext)
doPreExecute in class AbstractValidationActionprofileRequestContext - the current IdP profile request contextauthenticationContext - the current authentication context@Nonnull protected Subject populateSubject(@Nonnull Subject subject)
Subject with
Principal and credential information based on the validation they perform.
Typically this will include attaching a UsernamePrincipal,
but this is not a requirement if other components are suitably overridden.
populateSubject in class AbstractValidationActionsubject - subject to populateprotected void recordSuccess(@Nonnull ProfileRequestContext profileRequestContext)
profileRequestContext - current profile request contextprotected void recordFailure(@Nonnull ProfileRequestContext profileRequestContext, boolean inc)
profileRequestContext - current profile request contextinc - true iff lockout counter should be incrementedCopyright © 1999–2018 Shibboleth Consortium. All rights reserved.