Package net.shibboleth.idp.authn.impl
Class ValidateRemoteUser
java.lang.Object
- All Implemented Interfaces:
PrincipalSupportingComponent,Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
An action that checks for a
UsernameContext and directly produces an
AuthenticationResult based on that identity.
Various optional properties are supported to control the validation process.
- Event:
EventIds.PROCEED_EVENT_ID,AuthnEventIds.INVALID_CREDENTIALS,AuthnEventIds.NO_CREDENTIALS- Precondition:
ProfileRequestContext.getSubcontext(AuthenticationContext.class, false).getAttemptedFlow() != null
- Postcondition:
- If AuthenticationContext.getSubcontext(UsernameContext.class, false).getUsername() != null, then
an
AuthenticationResultis saved to theAuthenticationContext.
-
Field Summary
FieldsModifier and TypeFieldDescriptionUsernames to accept.private static final StringDefault prefix for metrics.Usernames to deny.private final org.slf4j.LoggerClass logger.private PatternA regular expression to apply for acceptance testing.private UsernameContextUsername context identifying identity to validate. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoExecute(ProfileRequestContext profileRequestContext, AuthenticationContext authenticationContext) Performs this authentication action.protected booleandoPreExecute(ProfileRequestContext profileRequestContext, AuthenticationContext authenticationContext) Performs this authentication action's pre-execute step.private booleanisAuthenticated(String username) Check whitelist, blacklist, and matching expression for acceptance.protected SubjectpopulateSubject(Subject subject) voidsetAllowedUsernames(Collection<String> allowed) Set the allowed usernames.voidsetDeniedUsernames(Collection<String> denied) Set the denied usernames.voidsetMatchExpression(Pattern expression) Set a matching expression to apply for acceptance.Methods inherited from class net.shibboleth.idp.authn.impl.AbstractAuditingValidationAction
doAudit, doExecute, getAuditContext, getAuditFields, recordFailure, recordSuccess, setAuditContextCreationStrategy, setPopulateAuditContextAction, setWriteAuditLogActionMethods inherited from class net.shibboleth.idp.authn.AbstractValidationAction
addDefaultPrincipals, buildAuthenticationResult, getClassifiedErrors, getCleanupHook, getMetricName, getRequesterLookupStrategy, getResponderLookupStrategy, getResultCachingPredicate, getSubject, getSupportedPrincipals, handleError, handleError, handleWarning, setAddDefaultPrincipals, setClassifiedMessages, setCleanupHook, setMetricName, setRequesterLookupStrategy, setResponderLookupStrategy, setResultCachingPredicate, setSupportedPrincipalsMethods inherited from class net.shibboleth.idp.authn.AbstractAuthenticationAction
doExecute, doPreExecute, setAuthenticationContextLookupStrategyMethods inherited from class net.shibboleth.idp.profile.AbstractProfileAction
execute, getBean, getBean, getMessage, getMessage, getMessage, getParameter, getParameter, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategyMethods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction
getActivationCondition, setActivationConditionMethods inherited from class org.opensaml.profile.action.AbstractProfileAction
doPostExecute, doPostExecute, ensureHttpServletRequest, ensureHttpServletResponse, execute, getHttpServletRequest, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, isPreExecuteCalled, setHttpServletRequestSupplier, setHttpServletResponseSupplierMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, doInitialize, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
DEFAULT_METRIC_NAME
Default prefix for metrics.- See Also:
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
allowedUsernames
Usernames to accept. -
deniedUsernames
Usernames to deny. -
matchExpression
A regular expression to apply for acceptance testing. -
usernameContext
Username context identifying identity to validate.
-
-
Constructor Details
-
ValidateRemoteUser
public ValidateRemoteUser()Constructor.
-
-
Method Details
-
setAllowedUsernames
Set the allowed usernames.- Parameters:
allowed- usernames to allow
-
setDeniedUsernames
Set the denied usernames.- Parameters:
denied- usernames to deny
-
setMatchExpression
Set a matching expression to apply for acceptance.- Parameters:
expression- a matching expression
-
doPreExecute
protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext) Performs this authentication action's pre-execute step. Default implementation just returns true.- Overrides:
doPreExecutein classAbstractValidationAction- Parameters:
profileRequestContext- the current IdP profile request contextauthenticationContext- the current authentication context- Returns:
- true iff execution should continue
-
doExecute
protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext) Performs this authentication action. Default implementation throws an exception.- Overrides:
doExecutein classAbstractAuthenticationAction- Parameters:
profileRequestContext- the current IdP profile request contextauthenticationContext- the current authentication context
-
isAuthenticated
Check whitelist, blacklist, and matching expression for acceptance.- Parameters:
username- the username to evaluate- Returns:
- true iff the username is acceptable
-
populateSubject
Subclasses must override this method to complete the population of theSubjectwithPrincipaland 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.- Specified by:
populateSubjectin classAbstractValidationAction- Parameters:
subject- subject to populate- Returns:
- the input subject
-