Class AddAuthnRequest
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
AuthnRequest and sets it as the message returned by
InOutOperationContext.getOutboundMessageContext().
If an issuer value is returned via a lookup strategy, then it's set as the Issuer of the message.
Various other values are derived from the active configuration such as RequestedAuthnContext,
NameIDPolicy, and Scoping. This process is much more complex than the IdP, as it requires
marrying together inputs from the agent against the profile configuration, including enforcing limits
on what the agent can override/supply.
This action is also responsible for creating a StateDataContext and populating a
SAMLStateData object with any relevant state necessary to preserve.
- Event:
EventIds.PROCEED_EVENT_ID,EventIds.INVALID_MESSAGE,EventIds.INVALID_MSG_CTX,EventIds.INVALID_PROFILE_CTX,IdPEventIds.INVALID_PROFILE_CONFIG- Postcondition:
- ProfileRequestContext.getOutboundMessageContext().getMessage() != null, ProfileRequestContext.ensureSubcontext(StateDataContext.class).getStateData() != null
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate IdentifierGenerationStrategyThe generator to use.Strategy used to locate theIdentifierGenerationStrategyto use.Map of agent binding tokens to SAML binding constants.private DDFInput message from agent.private StringEntityID to populate into Issuer element.private Function<ProfileRequestContext,String> Strategy used to obtain the request issuer value.private org.slf4j.LoggerClass logger.private Function<ProfileRequestContext,NameID> Optional strategy to populate request with aNameID.private booleanOverwrite an existing message?private BrowserSSOProfileConfigurationApplicable profile configuration.private booleanWhether tp fail if no response location is available.private SAMLStateDataCached state data object to populate.Strategy used to create theStateDataContextto populate. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ExtensionsbuildExtensions(ProfileRequestContext profileRequestContext) BuildRequestedAttributesextension if required.(package private) NameIDPolicybuildNameIDPolicy(ProfileRequestContext profileRequestContext, SAMLObjectBuilder<NameIDPolicy> builder) BuildNameIDPolicyobject for request.private RequestedAuthnContextbuildRequestedAuthnContext(ProfileRequestContext profileRequestContext) Build aRequestedAuthnContextif warranted.private ScopingbuildScoping(ProfileRequestContext profileRequestContext) Build aScopingelement, decrementing the proxy count if set.private SubjectbuildSubject(ProfileRequestContext profileRequestContext) Build aSubjectelement if necessary.protected voiddoExecute(ProfileRequestContext profileRequestContext) protected booleandoPreExecute(ProfileRequestContext profileRequestContext) private voidsetForceAuthn(ProfileRequestContext profileRequestContext, AuthnRequest authnRequest) Set ForceAuthn appropriately.voidsetIdentifierGeneratorLookupStrategy(Function<ProfileRequestContext, IdentifierGenerationStrategy> strategy) Set the strategy used to locate theIdentifierGenerationStrategyto use.voidsetInboundBindingMap(Map<String, String> map) Set mapping of legacy binding tokens to SAML binding constants.voidSet the strategy used to locate the issuer value to use.voidvoidsetOverwriteExisting(boolean flag) Set whether to overwrite an existing message.private booleansetResponseEndpoint(ProfileRequestContext profileRequestContext, AuthnRequest authnRequest) Sets the response endpoint and binding attributes in the request.voidsetResponseLocationRequired(boolean flag) Sets whether to signal failure if unable to establish an Assertion Consumer Service location to add to the request.voidSets the strategy used to create theStateDataContext.Methods inherited from class net.shibboleth.sp.profile.AbstractApplicationAction
ensureApplication, getApplicationMethods inherited from class net.shibboleth.sp.profile.AbstractAgentAction
ensureAgent, getAgentMethods inherited from class net.shibboleth.sp.profile.AbstractAgentRequestAction
ensureAgentRequestContext, getAgentRequestContext, setAgentRequestContextLookupStrategyMethods 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, 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
-
log
@Nonnull private org.slf4j.Logger logClass logger. -
overwriteExisting
private boolean overwriteExistingOverwrite an existing message? -
idGeneratorLookupStrategy
@Nonnull private Function<ProfileRequestContext,IdentifierGenerationStrategy> idGeneratorLookupStrategyStrategy used to locate theIdentifierGenerationStrategyto use. -
stateDataContextCreationStrategy
Strategy used to create theStateDataContextto populate. -
issuerLookupStrategy
Strategy used to obtain the request issuer value. -
nameIDLookupStrategy
Optional strategy to populate request with aNameID. -
inboundBindingMap
Map of agent binding tokens to SAML binding constants. -
responseLocationRequired
private boolean responseLocationRequiredWhether tp fail if no response location is available. -
idGenerator
The generator to use. -
profileConfiguration
Applicable profile configuration. -
input
Input message from agent. -
stateData
Cached state data object to populate. -
issuerId
EntityID to populate into Issuer element.
-
-
Constructor Details
-
AddAuthnRequest
public AddAuthnRequest()Constructor.
-
-
Method Details
-
setOverwriteExisting
public void setOverwriteExisting(boolean flag) Set whether to overwrite an existing message.- Parameters:
flag- flag to set
-
setIdentifierGeneratorLookupStrategy
public void setIdentifierGeneratorLookupStrategy(@Nonnull Function<ProfileRequestContext, IdentifierGenerationStrategy> strategy) Set the strategy used to locate theIdentifierGenerationStrategyto use.- Parameters:
strategy- lookup strategy
-
setStateDataContextCreationStrategy
public void setStateDataContextCreationStrategy(@Nonnull Function<ProfileRequestContext, StateDataContext> strategy) Sets the strategy used to create theStateDataContext.- Parameters:
strategy- creation strategy
-
setIssuerLookupStrategy
Set the strategy used to locate the issuer value to use.- Parameters:
strategy- lookup strategy
-
setNameIDLookupStrategy
- Parameters:
strategy- lookup strategy
-
setInboundBindingMap
Set mapping of legacy binding tokens to SAML binding constants.This is a legacy compatibility feature allowing binding-specific response endpoints to be supported. Agents will supply a structure that maps endpoints to binding tokens (e.g., POST, Artifact) and this mapping determines the binding constants to use in requests. This is a simplification to avoid contaminating agents with SAML constants.
- Parameters:
map- binding map
-
setResponseLocationRequired
public void setResponseLocationRequired(boolean flag) Sets whether to signal failure if unable to establish an Assertion Consumer Service location to add to the request.Defaults to false. Usually needed only for ECP.
- Parameters:
flag-
-
doPreExecute
- Overrides:
doPreExecutein classAbstractApplicationAction
-
doExecute
- Overrides:
doExecutein classAbstractProfileAction
-
setResponseEndpoint
private boolean setResponseEndpoint(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthnRequest authnRequest) Sets the response endpoint and binding attributes in the request.This is messy due to support for legacy SPs avoiding metadata changes by allowing for the older design of an endpoint per binding. Some of these cases aren't expected to arise but are implemented for completeness.
- Parameters:
profileRequestContext- profile request contextauthnRequest- request message- Returns:
- true iff successful in picking an endpoint
-
setForceAuthn
private void setForceAuthn(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull AuthnRequest authnRequest) Set ForceAuthn appropriately.- Parameters:
profileRequestContext- profile request contextauthnRequest- request object
-
buildNameIDPolicy
@Nonnull NameIDPolicy buildNameIDPolicy(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull SAMLObjectBuilder<NameIDPolicy> builder) BuildNameIDPolicyobject for request.- Parameters:
profileRequestContext- profile request contextbuilder- object builder- Returns:
- policy object
-
buildRequestedAuthnContext
@Nullable private RequestedAuthnContext buildRequestedAuthnContext(@Nullable ProfileRequestContext profileRequestContext) Build aRequestedAuthnContextif warranted.- Parameters:
profileRequestContext- current profile request context- Returns:
- the object to include in the request, or null
-
buildSubject
Build aSubjectelement if necessary.- Parameters:
profileRequestContext- profile request context- Returns:
- the
Subjectelement to include
-
buildScoping
Build aScopingelement, decrementing the proxy count if set.- Parameters:
profileRequestContext- current profile request context- Returns:
- populated
Scoping
-
buildExtensions
BuildRequestedAttributesextension if required.- Parameters:
profileRequestContext- current profile request context- Returns:
- extension or null
-