Package net.shibboleth.sp.authn.impl
Class InitializeAgentRequestContext
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.profile.action.AbstractProfileAction
org.opensaml.profile.action.AbstractConditionalProfileAction
net.shibboleth.idp.profile.AbstractProfileAction
net.shibboleth.idp.authn.AbstractAuthenticationAction
net.shibboleth.sp.authn.impl.InitializeAgentRequestContext
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
An authentication action that relies on extracted HTTP authentication credentials
to resolve the appropriate
Agent and create an AgentRequestContext.- Event:
EventIds.PROCEED_EVENT_ID,EventIds.INVALID_PROFILE_CTX,EventIds.IO_ERROR,AuthnEventIds.UNKNOWN_USERNAME- Precondition:
ProfileRequestContext.getSubcontext(AuthenticationContext.class) != null
- Postcondition:
ProfileRequestContext.ensureSubcontext(AgentRequestContext.class).getAgent() != null
,An MDC logging attribute is created with the successfully resolved ID.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMDC attribute name for agent ID.private StringCached agent credential ID from "username".Creation strategy forAgentRequestContext.private ReloadableService<AgentResolver>The agent resolver.private final org.slf4j.LoggerClass logger.private booleanWhether to populate the MDC.Lookup strategy forUsernamePasswordContext. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoExecute(ProfileRequestContext profileRequestContext, AuthenticationContext authenticationContext) protected voidprotected booleandoPreExecute(ProfileRequestContext profileRequestContext, AuthenticationContext authenticationContext) voidsetAgentRequestContextCreationStrategy(Function<ProfileRequestContext, AgentRequestContext> strategy) Sets the creation strategy for theAgentRequestContext.voidsetAgentResolver(ReloadableService<AgentResolver> service) Sets theAgentResolverservice to use.voidsetPopulateMDC(boolean flag) Sets whether to populate the agent ID into the logging MDC.voidsetUsernamePasswordContextLookupStrategy(Function<ProfileRequestContext, UsernamePasswordContext> strategy) Sets the lookup strategy for theUsernamePasswordContext.Methods inherited from class net.shibboleth.idp.authn.AbstractAuthenticationAction
doExecute, 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
-
AGENT_ID_MDC_ATTRIBUTE
MDC attribute name for agent ID.- See Also:
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
usernamePasswordContextLookupStrategy
@Nonnull private Function<ProfileRequestContext,UsernamePasswordContext> usernamePasswordContextLookupStrategyLookup strategy forUsernamePasswordContext. -
agentRequestContextCreationStrategy
@Nonnull private Function<ProfileRequestContext,AgentRequestContext> agentRequestContextCreationStrategyCreation strategy forAgentRequestContext. -
agentResolver
The agent resolver. -
populateMDC
private boolean populateMDCWhether to populate the MDC. -
agentCredentialID
Cached agent credential ID from "username".
-
-
Constructor Details
-
InitializeAgentRequestContext
public InitializeAgentRequestContext()Constructor.
-
-
Method Details
-
setUsernamePasswordContextLookupStrategy
public void setUsernamePasswordContextLookupStrategy(@Nonnull Function<ProfileRequestContext, UsernamePasswordContext> strategy) Sets the lookup strategy for theUsernamePasswordContext.- Parameters:
strategy- lookup strategy
-
setAgentRequestContextCreationStrategy
public void setAgentRequestContextCreationStrategy(@Nonnull Function<ProfileRequestContext, AgentRequestContext> strategy) Sets the creation strategy for theAgentRequestContext.- Parameters:
strategy- creation strategy
-
setPopulateMDC
public void setPopulateMDC(boolean flag) Sets whether to populate the agent ID into the logging MDC.Defaults to true.
- Parameters:
flag- flag to set
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
doPreExecute
protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext) - Overrides:
doPreExecutein classAbstractAuthenticationAction
-
doExecute
protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthenticationContext authenticationContext) - Overrides:
doExecutein classAbstractAuthenticationAction
-