public class ValidateUsernamePasswordAgainstJAAS extends AbstractUsernamePasswordValidationAction
UsernamePasswordContext and directly produces an
AuthenticationResult based on that identity by invoking a JAAS configuration.
Various optional properties are supported to control the JAAS configuration process.
EventIds.PROCEED_EVENT_ID, AuthnEventIds.NO_CREDENTIALS, AuthnEventIds.INVALID_CREDENTIALS, AuthnEventIds.REQUEST_UNSUPPORTEDProfileRequestContext.getSubcontext(AuthenticationContext.class).getAttemptedFlow() != null
AuthenticationResult 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 | Class and Description |
|---|---|
protected class |
ValidateUsernamePasswordAgainstJAAS.SimpleCallbackHandler
A callback handler that provides static name and password data to a JAAS login process.
|
| Modifier and Type | Field and Description |
|---|---|
private String |
currentLoginConfigName
Tracker for current login config for reporting.
|
private static String |
DEFAULT_METRIC_NAME
Default prefix for metrics.
|
private Subject |
derivedSubject
Tracks any principals derived from the login configuration to add to the Subject.
|
private org.slf4j.Logger |
log
Class logger.
|
private Configuration.Parameters |
loginConfigParameters
Type-specific configuration parameters.
|
private com.google.common.base.Function<ProfileRequestContext,Collection<Pair<String,Subject>>> |
loginConfigStrategy
Strategy function to dynamically derive the login config(s) to use.
|
private String |
loginConfigType
Type of JAAS Configuration to instantiate.
|
private Collection<Pair<String,Subject>> |
loginConfigurations
Application name(s) in JAAS configuration to use.
|
private RequestedPrincipalContext |
requestedPrincipalCtx
Saved off context.
|
| Constructor and Description |
|---|
ValidateUsernamePasswordAgainstJAAS()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
authenticate(String loginConfigName)
Create a JAAS configuration and attempt a login with it.
|
protected void |
doExecute(ProfileRequestContext profileRequestContext,
AuthenticationContext authenticationContext) |
protected boolean |
doPreExecute(ProfileRequestContext profileRequestContext,
AuthenticationContext authenticationContext) |
Configuration.Parameters |
getLoginConfigParameters()
Get the type-specific parameters of the JAAS
Configuration to use. |
String |
getLoginConfigType()
Get the type of JAAS
Configuration to use. |
String |
getMetricName() |
private boolean |
isAcceptable(AuthenticationContext authenticationContext,
String configName,
Subject subject)
Checks a particular JAAS configuration and principal collection for suitability.
|
protected Subject |
populateSubject(Subject subject) |
void |
setLoginConfigNames(Collection<String> names)
Set the JAAS application name(s) to use.
|
void |
setLoginConfigParameters(Configuration.Parameters params)
Set the type-specific parameters of the JAAS
Configuration to use. |
void |
setLoginConfigStrategy(com.google.common.base.Function<ProfileRequestContext,Collection<Pair<String,Subject>>> strategy)
Set the strategy function to use to obtain the JAAS application configuration(s) to use.
|
void |
setLoginConfigType(String type)
Set the type of JAAS
Configuration to use. |
void |
setLoginConfigurations(Collection<Pair<String,Collection<Principal>>> configs)
Set the JAAS application name(s) to use, along with an optional collection of custom principals to
apply to the result.
|
getLockoutManager, getUsernamePasswordContext, recordFailure, recordSuccess, removeContextAfterValidation, savePasswordToCredentialSet, setLockoutManager, setMatchExpression, setRemoveContextAfterValidation, setSavePasswordToCredentialSetaddDefaultPrincipals, buildAuthenticationResult, getClassifiedErrors, getResultCachingPredicate, getSubject, getSupportedPrincipals, handleError, handleError, handleWarning, recordFailure, recordSuccess, setAddDefaultPrincipals, setClassifiedMessages, setMetricName, setRequesterLookupStrategy, setResponderLookupStrategy, setResultCachingPredicate, setSupportedPrincipalsdoExecute, 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
@Nullable private Configuration.Parameters loginConfigParameters
@Nonnull private Collection<Pair<String,Subject>> loginConfigurations
@Nullable private com.google.common.base.Function<ProfileRequestContext,Collection<Pair<String,Subject>>> loginConfigStrategy
@Nullable private RequestedPrincipalContext requestedPrincipalCtx
@Nullable private Subject derivedSubject
public ValidateUsernamePasswordAgainstJAAS()
@Nullable public String getLoginConfigType()
Configuration to use.public void setLoginConfigType(@Nullable String type)
Configuration to use.type - the type of JAAS configuration to use@Nullable public Configuration.Parameters getLoginConfigParameters()
Configuration to use.public void setLoginConfigParameters(@Nullable Configuration.Parameters params)
Configuration to use.params - the JAAS configuration parameters to usepublic void setLoginConfigurations(@Nullable Collection<Pair<String,Collection<Principal>>> configs)
configs - list of JAAS application names and custom principals to usepublic void setLoginConfigNames(@Nullable@NonnullElements Collection<String> names)
names - list of JAAS application names to usepublic void setLoginConfigStrategy(@Nullable com.google.common.base.Function<ProfileRequestContext,Collection<Pair<String,Subject>>> strategy)
strategy - strategy functionprotected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext)
doPreExecute in class AbstractUsernamePasswordValidationActionprotected void doExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext)
doExecute in class AbstractAuthenticationActionprivate boolean isAcceptable(@Nonnull AuthenticationContext authenticationContext, @Nonnull@NotEmpty String configName, @Nullable Subject subject)
authenticationContext - the authentication contextconfigName - name of JAAS configsubject - collection of custom principals to check, embedded in a subjectprivate void authenticate(@Nonnull@NotEmpty String loginConfigName) throws LoginException, NoSuchAlgorithmException
loginConfigName - the application name to useLoginException - if the JAAS login process failsNoSuchAlgorithmException - if a JAAS configuration cannot be created@Nonnull protected Subject populateSubject(@Nonnull Subject subject)
populateSubject in class AbstractUsernamePasswordValidationAction@Nonnull @NotEmpty public String getMetricName()
getMetricName in class AbstractValidationActionCopyright © 1999–2018 Shibboleth Consortium. All rights reserved.