Package net.shibboleth.idp.authn.impl
Class ValidateFunctionResult
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
org.opensaml.profile.action.AbstractProfileAction
org.opensaml.profile.action.AbstractConditionalProfileAction
net.shibboleth.idp.profile.AbstractProfileAction
net.shibboleth.idp.authn.AbstractAuthenticationAction
net.shibboleth.idp.authn.AbstractValidationAction
net.shibboleth.idp.authn.impl.AbstractAuditingValidationAction
net.shibboleth.idp.authn.impl.ValidateFunctionResult
- All Implemented Interfaces:
PrincipalSupportingComponent
,Component
,DestructableComponent
,InitializableComponent
,ProfileAction
,Aware
,MessageSource
,MessageSourceAware
,Action
An action that executes a deployer-supplied function and produces an
AuthenticationResult
based on the function result.- Since:
- 3.4.0
- Event:
EventIds.PROCEED_EVENT_ID
,AuthnEventIds.INVALID_CREDENTIALS
,AuthnEventIds.NO_CREDENTIALS
- Precondition:
ProfileRequestContext.getSubcontext(AuthenticationContext.class).getAttemptedFlow() != null
- Postcondition:
- If the function returns a String, Principal, or Subject, an
AuthenticationResult
is saved to theAuthenticationContext
.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
Default prefix for metrics.private final org.slf4j.Logger
Class logger.private Object
Authentication result.private Function<ProfileRequestContext,
?> Function to evaluate. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
doExecute
(ProfileRequestContext profileRequestContext, AuthenticationContext authenticationContext) Performs this authentication action.protected void
getAuditFields
(ProfileRequestContext profileRequestContext) Subclasses can override this method to supply additional audit fields to store.private String
getUsername
(Subject subject) Get the username from aUsernamePrincipal
inside the subject.protected Subject
populateSubject
(Subject subject) void
setResultLookupStrategy
(Function<ProfileRequestContext, ?> strategy) Set the function to execute to produce the authentication result.Methods inherited from class net.shibboleth.idp.authn.impl.AbstractAuditingValidationAction
doAudit, doExecute, getAuditContext, recordFailure, recordSuccess, setAuditContextCreationStrategy, setPopulateAuditContextAction, setWriteAuditLogAction
Methods inherited from class net.shibboleth.idp.authn.AbstractValidationAction
addDefaultPrincipals, buildAuthenticationResult, doPreExecute, getClassifiedErrors, getCleanupHook, getMetricName, getRequesterLookupStrategy, getResponderLookupStrategy, getResultCachingPredicate, getSubject, getSupportedPrincipals, handleError, handleError, handleWarning, recordFailure, recordSuccess, setAddDefaultPrincipals, setClassifiedMessages, setCleanupHook, setMetricName, setRequesterLookupStrategy, setResponderLookupStrategy, setResultCachingPredicate, setSupportedPrincipals
Methods inherited from class net.shibboleth.idp.authn.AbstractAuthenticationAction
doExecute, doPreExecute, setAuthenticationContextLookupStrategy
Methods inherited from class net.shibboleth.idp.profile.AbstractProfileAction
execute, getBean, getBean, getMessage, getMessage, getMessage, getParameter, getParameter, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategy
Methods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction
getActivationCondition, setActivationCondition
Methods inherited from class org.opensaml.profile.action.AbstractProfileAction
doPostExecute, doPostExecute, execute, getHttpServletRequest, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, setHttpServletRequest, setHttpServletRequestSupplier, setHttpServletResponse, setHttpServletResponseSupplier
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
DEFAULT_METRIC_NAME
Default prefix for metrics.- See Also:
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
resultLookupStrategy
Function to evaluate. -
result
Authentication result.
-
-
Constructor Details
-
ValidateFunctionResult
public ValidateFunctionResult()Constructor.
-
-
Method Details
-
setResultLookupStrategy
Set the function to execute to produce the authentication result.The function can return a
String
, aPrincipal
, or aSubject
.- Parameters:
strategy
- result strategy
-
doInitialize
- Overrides:
doInitialize
in classAbstractInitializableComponent
- Throws:
ComponentInitializationException
-
doExecute
protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext) Performs this authentication action. Default implementation throws an exception.- Overrides:
doExecute
in classAbstractAuthenticationAction
- Parameters:
profileRequestContext
- the current IdP profile request contextauthenticationContext
- the current authentication context
-
populateSubject
Subclasses must override this method to complete the population of theSubject
withPrincipal
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.- Specified by:
populateSubject
in classAbstractValidationAction
- Parameters:
subject
- subject to populate- Returns:
- the input subject
-
getAuditFields
@Nullable protected Map<String,String> getAuditFields(@Nonnull ProfileRequestContext profileRequestContext) Subclasses can override this method to supply additional audit fields to store.- Overrides:
getAuditFields
in classAbstractAuditingValidationAction
- Parameters:
profileRequestContext
- profile request context- Returns:
- audit fields
-
getUsername
Get the username from aUsernamePrincipal
inside the subject.- Parameters:
subject
- input subject- Returns:
- username, or null
-