Class PopulateDuoAuthenticationContext
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
DuoOIDCAuthenticationContext
with the username, chosen DuoOIDCIntegration, and DuoOIDCClient appropriate for this request.
Determines the usable redirect_uri, either from one registered, or computed from the HTTP request. Is set once, before the client is constructed, for every client. If however, the client supports dynamic use of the redirect_uri, it is also set into the context for use downstream.
Adds the nonce part of the state parameter for matching on callback from the 2FA check.
- Event:
EventIds.PROCEED_EVENT_ID,EventIds.INVALID_PROFILE_CTX,AuthnEventIds.NO_CREDENTIALS,AuthnEventIds.AUTHN_EXCEPTION- Postcondition:
- See above.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DuoOIDCClientRegistryThe registry for locating the DuoClient for the established integration.Strategy used to locate or create theDuoOIDCAuthenticationContextto populate.Lookup strategy for Duo integration.private final org.slf4j.LoggerClass logger.Strategy used to compute the redirectURI from the given Duo integration if supported.private Function<ProfileRequestContext,String> Lookup strategy for username to match against Duo identity. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcomputeAndStoreRedirectURIIfSupported(DuoOIDCIntegration duoIntegration, HttpServletRequest request, DuoOIDCAuthenticationContext context) ForDynamicDuoOIDCIntegrations, apply the redirect_uri creation strategy to compute a redirect_uri to use.protected voiddoExecute(ProfileRequestContext profileRequestContext, AuthenticationContext authenticationContext) protected voidvoidsetClientRegistry(DuoOIDCClientRegistry duoRegistry) Set the Duo client registry.voidsetDuoContextCreationStrategy(Function<ProfileRequestContext, DuoOIDCAuthenticationContext> strategy) Set the strategy used to locate theDuoOIDCAuthenticationContextto operate on.voidSet DuoIntegration lookup strategy to use.voidsetRedirectURICreationStrategy(BiFunction<HttpServletRequest, DynamicDuoOIDCIntegration, String> strategy) Set the redirect URI creation strategy.voidSet the lookup strategy to use for the username to match against Duo identity.Methods inherited from class net.shibboleth.idp.authn.AbstractAuthenticationAction
doExecute, doPreExecute, doPreExecute, setAuthenticationContextLookupStrategyMethods inherited from class net.shibboleth.idp.profile.AbstractProfileAction
doExecute, 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, 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
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
duoAuthContextCreationStrategy
@Nonnull private Function<ProfileRequestContext,DuoOIDCAuthenticationContext> duoAuthContextCreationStrategyStrategy used to locate or create theDuoOIDCAuthenticationContextto populate. -
usernameLookupStrategy
Lookup strategy for username to match against Duo identity. -
duoIntegrationLookupStrategy
Lookup strategy for Duo integration. -
redirectURICreationStrategy
@Nullable private BiFunction<HttpServletRequest,DynamicDuoOIDCIntegration, redirectURICreationStrategyString> Strategy used to compute the redirectURI from the given Duo integration if supported. -
clientRegistry
The registry for locating the DuoClient for the established integration.
-
-
Constructor Details
-
PopulateDuoAuthenticationContext
public PopulateDuoAuthenticationContext()Constructor.
-
-
Method Details
-
setClientRegistry
Set the Duo client registry.- Parameters:
duoRegistry- the registry
-
setUsernameLookupStrategy
Set the lookup strategy to use for the username to match against Duo identity.- Parameters:
strategy- lookup strategy
-
setRedirectURICreationStrategy
public void setRedirectURICreationStrategy(@Nonnull BiFunction<HttpServletRequest, DynamicDuoOIDCIntegration, String> strategy) Set the redirect URI creation strategy. The strategy is free to use or create a redirectURI based either on runtime parameters, or static information in theDuoOIDCIntegration.- Parameters:
strategy- the creation strategy.
-
setDuoContextCreationStrategy
public void setDuoContextCreationStrategy(@Nonnull Function<ProfileRequestContext, DuoOIDCAuthenticationContext> strategy) Set the strategy used to locate theDuoOIDCAuthenticationContextto operate on.- Parameters:
strategy- lookup strategy
-
setDuoIntegrationLookupStrategy
public void setDuoIntegrationLookupStrategy(@Nonnull Function<ProfileRequestContext, DuoOIDCIntegration> strategy) Set DuoIntegration lookup strategy to use.- Parameters:
strategy- lookup strategy
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
doExecute
protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext) - Overrides:
doExecutein classAbstractAuthenticationAction
-
computeAndStoreRedirectURIIfSupported
private void computeAndStoreRedirectURIIfSupported(@Nonnull DuoOIDCIntegration duoIntegration, @Nonnull HttpServletRequest request, @Nonnull DuoOIDCAuthenticationContext context) throws DuoException For
DynamicDuoOIDCIntegrations, apply the redirect_uri creation strategy to compute a redirect_uri to use.The redirect_uri is computed for each request, but is only set once as the usable redirect_uri on the integration itself i.e. for the client to read using
DuoOIDCIntegration.getRedirectURI(). This allows all clients to see a computed (by theredirectURICreationStrategy) redirect_uri from the first request onward.The computed redirect_uri is also added to the context as an override redirect_uri which - if supported by the client - can be used dynamically when creating authorization or token exchange requests.
- Parameters:
duoIntegration- the Duo integration pertaining to this request.request- the http servlet request.context- the Duo authentication context to store the computed override redirect_uri.- Throws:
DuoException- if the redirect_uri could not be created by the strategy.
-