public class TransitionMultiFactorAuthentication extends AbstractAuthenticationAction
This is the heart of the MFA processing sequence, and runs after the
MultiFactorAuthenticationContext has been populated. It uses the current/previous
flow and the transition rules to decide when to transition to a new flow, when work is
complete, and the final event to signal in the event of a problem.
The execution of this function is driven by the MultiFactorAuthenticationTransition
rule associated with the flow that was most recently executed by this engine. If none (such as
during the first iteration), then the rule associated with a null flow ID is used. Failure to
locate a transition to use is fatal, resulting in AuthnEventIds.NO_PASSIVE or
AuthnEventIds.NO_POTENTIAL_FLOW.
Otherwise, a function is applied to obtain the "current" WebFlow event, and the event is applied to the transition's rule map to obtain the name of the next flow to run. A wildcard ('*') rule is used if a more specific rule isn't found.
If the transition signals a null/empty flow ID to run, then
MultiFactorAuthenticationContext.getNextFlowId() is cleared to signal the MFA flow
that it should complete itself. The result of the action is either
MultiFactorAuthenticationContext.getEvent() (if set), or the current WebFlow event.
If a flow is returned, it is populated into the MultiFactorAuthenticationContext.
The flow is checked for the "authn/" prefix, and a login flow is checked against the
active result map to determine if it can be reused, in which case the action recurses itself.
Otherwise EventIds.PROCEED_EVENT_IDis signaled to run that flow.
By default, login flow transitions are validated against the request's requirements in terms of passive, forced re-authn, and non-browser compatibility.
EventIds.PROCEED_EVENT_ID, EventIds.INVALID_PROFILE_CTX, AuthnEventIds.NO_PASSIVE, AuthnEventIds.NO_POTENTIAL_FLOW, AuthnEventIds.REQUEST_UNSUPPORTED, (any event signaled by another called flow)ProfileRequestContext.getSubcontext(AuthenticationContext.class).getSubcontext(
MultiFactorAuthenticationContext.class) != null| Modifier and Type | Field and Description |
|---|---|
private com.google.common.base.Function<ProfileRequestContext,EventContext> |
eventContextLookupStrategy
Lookup function for current event context.
|
private org.slf4j.Logger |
log
Class logger.
|
private MultiFactorAuthenticationContext |
mfaContext
A subordinate
MultiFactorAuthenticationContext, if any. |
private com.google.common.base.Function<ProfileRequestContext,MultiFactorAuthenticationContext> |
multiFactorContextLookupStrategy
Lookup function for the context to evaluate.
|
private boolean |
validateLoginTransitions
Perform IsPassive, ForceAuthn, and non-browser checks when running login flows.
|
| Constructor and Description |
|---|
TransitionMultiFactorAuthentication()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
doExecute(ProfileRequestContext profileRequestContext,
AuthenticationContext authenticationContext) |
protected boolean |
doPreExecute(ProfileRequestContext profileRequestContext,
AuthenticationContext authenticationContext) |
private void |
doTransition(ProfileRequestContext profileRequestContext,
AuthenticationContext authenticationContext,
MultiFactorAuthenticationTransition transition)
Respond to a signal to transition the MFA process to a new flow.
|
void |
setEventContextLookupStrategy(com.google.common.base.Function<ProfileRequestContext,EventContext> strategy)
Set the lookup strategy to use for the current event context.
|
void |
setMultiFactorContextLookupStrategy(com.google.common.base.Function<ProfileRequestContext,MultiFactorAuthenticationContext> strategy)
Set the lookup strategy to use for the context to evaluate.
|
void |
setValidateLoginTransitions(boolean flag)
Set whether to validate transitions to a new login flow by evaluating the request
and ensuring options like IsPassive and ForceAuthn are compatible with the flow.
|
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 private final org.slf4j.Logger log
@Nonnull private com.google.common.base.Function<ProfileRequestContext,MultiFactorAuthenticationContext> multiFactorContextLookupStrategy
@Nonnull private com.google.common.base.Function<ProfileRequestContext,EventContext> eventContextLookupStrategy
private boolean validateLoginTransitions
@Nullable private MultiFactorAuthenticationContext mfaContext
MultiFactorAuthenticationContext, if any.TransitionMultiFactorAuthentication()
public void setMultiFactorContextLookupStrategy(@Nonnull com.google.common.base.Function<ProfileRequestContext,MultiFactorAuthenticationContext> strategy)
strategy - lookup strategypublic void setEventContextLookupStrategy(@Nonnull com.google.common.base.Function<ProfileRequestContext,EventContext> strategy)
strategy - lookup strategypublic void setValidateLoginTransitions(boolean flag)
Defaults to 'true', override if your custom transition logic handles these issues.
flag - flag to setprotected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext)
doPreExecute in class AbstractAuthenticationActionprotected void doExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext)
doExecute in class AbstractAuthenticationActionprivate void doTransition(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext, @Nonnull MultiFactorAuthenticationTransition transition)
profileRequestContext - profile request contextauthenticationContext - authentication contexttransition - transition rule to useCopyright © 1999–2018 Shibboleth Consortium. All rights reserved.