Class RequestContextBuilder
java.lang.Object
net.shibboleth.idp.profile.testing.RequestContextBuilder
Builder used to construct
RequestContext used in Action
executions.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate HttpServletRequestTheHttpServletRequestused when building the request context.private HttpServletResponseTheHttpServletResponseused when building the request context.private ObjectThe inbound message.private StringThe ID of the inbound message.private InstantThe issue instant of the inbound message.private StringThe issuer of the inbound message.private static final StringValue used to represent a string value that has not be set.private ObjectThe outbound message.private StringThe ID of the outbound message.private InstantThe issue instant of the outbound message.private StringThe issuer of the outbound message.private Collection<ProfileConfiguration>The profile configurations associated with the relying party.private ServletContextTheServletContextused when building the request context. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.RequestContextBuilder(RequestContextBuilder prototype) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected MessageContextBuilds a inboundMessageContext.protected MessageContextBuilds a outboundMessageContext.Builds aProfileRequestContext.protected RelyingPartyConfigurationBuilds aRelyingPartyConfiguration.protected RelyingPartyContextbuildRelyingPartyContext(ProfileRequestContext profileRequestContext) BuildsRelyingPartyContext.Builds aMockRequestContext.Builds aServletExternalContext.protected ProfileConfigurationselectProfileConfiguration(Map<String, ProfileConfiguration> rpProfileConfigs) Selects the active profile configurations from the set of registered profile configuration from the relying party configuration built bybuildRelyingPartyConfiguration().setHttpRequest(HttpServletRequest request) Sets theHttpServletRequestused when building the request context.setHttpResponse(HttpServletResponse response) Sets theHttpServletResponseused when building the request context.setInboundMessage(Object message) Sets the inbound message.Sets the ID of the inbound message.setInboundMessageIssueInstant(Instant instant) Sets the issue instant of the inbound messagesetInboundMessageIssuer(String issuer) Sets the issuer of the inbound message.setOutboundMessage(Object message) Sets the outbound message.Sets the ID of the outbound message.setOutboundMessageIssueInstant(Instant instant) Sets the issue instant of the outbound messagesetOutboundMessageIssuer(String issuer) Sets the issuer of the outbound message.Sets the profile configurations associated with the relying party.setServletContext(ServletContext context) Sets theServletContextused when building the request context.
-
Field Details
-
NO_VAL
Value used to represent a string value that has not be set.- See Also:
-
servletContext
TheServletContextused when building the request context. -
httpRequest
TheHttpServletRequestused when building the request context. -
httpResponse
TheHttpServletResponseused when building the request context. -
inboundMessageId
The ID of the inbound message. -
inboundMessageIssueInstant
The issue instant of the inbound message. -
inboundMessageIssuer
The issuer of the inbound message. -
inboundMessage
The inbound message. -
outboundMessageId
The ID of the outbound message. -
outboundMessageIssueInstant
The issue instant of the outbound message. -
outboundMessageIssuer
The issuer of the outbound message. -
outboundMessage
The outbound message. -
relyingPartyProfileConfigurations
The profile configurations associated with the relying party.
-
-
Constructor Details
-
RequestContextBuilder
public RequestContextBuilder()Constructor. -
RequestContextBuilder
Constructor.- Parameters:
prototype- prototype whose properties are copied onto this builder
-
-
Method Details
-
setServletContext
Sets theServletContextused when building the request context.- Parameters:
context- theServletContextused when building the request context- Returns:
- this builder
-
setHttpRequest
Sets theHttpServletRequestused when building the request context.- Parameters:
request- theHttpServletRequestused when building the request context- Returns:
- this builder
-
setHttpResponse
Sets theHttpServletResponseused when building the request context.- Parameters:
response- theHttpServletResponseused when building the request context- Returns:
- this builder
-
setInboundMessageId
Sets the ID of the inbound message.- Parameters:
id- ID of the inbound message- Returns:
- this builder
-
setInboundMessageIssueInstant
Sets the issue instant of the inbound message- Parameters:
instant- issue instant of the inbound message- Returns:
- this builder
-
setInboundMessageIssuer
Sets the issuer of the inbound message.- Parameters:
issuer- issuer of the inbound message- Returns:
- this builder
-
setInboundMessage
Sets the inbound message.- Parameters:
message- the inbound message- Returns:
- this builder
-
setOutboundMessageId
Sets the ID of the outbound message.- Parameters:
id- ID of the outbound message- Returns:
- this builder
-
setOutboundMessageIssueInstant
Sets the issue instant of the outbound message- Parameters:
instant- issue instant of the outbound message- Returns:
- this builder
-
setOutboundMessageIssuer
Sets the issuer of the outbound message.- Parameters:
issuer- issuer of the outbound message- Returns:
- this builder
-
setOutboundMessage
Sets the outbound message.- Parameters:
message- the outbound message- Returns:
- this builder
-
setRelyingPartyProfileConfigurations
@Nonnull public RequestContextBuilder setRelyingPartyProfileConfigurations(@Nullable Collection<ProfileConfiguration> configs) Sets the profile configurations associated with the relying party.- Parameters:
configs- profile configurations associated with the relying party- Returns:
- this builder
-
buildRequestContext
Builds aMockRequestContext. The default implementation builds aMockRequestContextthat contains a:- Returns:
- the constructed
MockRequestContext - Throws:
ComponentInitializationException- ...
-
buildServletExternalContext
Builds aServletExternalContext. The default implementations builds aServletExternalContextthat contains a:- the
ServletContextprovided bysetServletContext(ServletContext)or aMockServletContextif none was provided - the
HttpServletRequestprovided bysetHttpRequest(HttpServletRequest)or aMockHttpServletRequestif none was provided - the
HttpServletResponseprovided bysetHttpResponse(HttpServletResponse)or aMockHttpServletResponseif none was provided
- Returns:
- the constructed
ServletContext
- the
-
buildProfileRequestContext
@Nonnull public ProfileRequestContext buildProfileRequestContext() throws ComponentInitializationExceptionBuilds aProfileRequestContext. The default implementation builds aProfileRequestContextthat contains a:- inbound message context created by
buildInboundMessageContext() - outbound message context created by
buildOutboundMessageContext() RelyingPartyContextcreated bybuildRelyingPartyContext(ProfileRequestContext)
- Returns:
- the constructed {
- Throws:
ComponentInitializationException- @link ProfileRequestContext
- inbound message context created by
-
buildInboundMessageContext
Builds a inboundMessageContext. The default implementation builds aMessageContextthat contains:- the message provided by
setInboundMessage(Object)
- Returns:
- the constructed
MessageContext
- the message provided by
-
buildOutboundMessageContext
Builds a outboundMessageContext. The default implementation builds aMessageContextthat contains:- the message provided by
setOutboundMessage(Object)
- Returns:
- the constructed
MessageContext
- the message provided by
-
buildRelyingPartyContext
@Nonnull protected RelyingPartyContext buildRelyingPartyContext(@Nonnull ProfileRequestContext profileRequestContext) throws ComponentInitializationException BuildsRelyingPartyContext. The default implementations builds aRelyingPartyContextwith:- a relying party ID provided by
setInboundMessageIssuer(String)orActionTestingSupport.INBOUND_MSG_ISSUERif none is given - a relying party configuration built by
buildRelyingPartyConfiguration() - the active profile selected, out of the profiles registered with the built relying party configuration, by
selectProfileConfiguration(Map)
- Parameters:
profileRequestContext- ...- Returns:
- the constructed
RelyingPartyContext - Throws:
ComponentInitializationException- ...
- a relying party ID provided by
-
buildRelyingPartyConfiguration
@Nonnull protected RelyingPartyConfiguration buildRelyingPartyConfiguration() throws ComponentInitializationExceptionBuilds aRelyingPartyConfiguration. The default implementation of this method builds aRelyingPartyConfigurationsuch that:- configuration ID is 'mock'
- the responder ID provided by
setOutboundMessageIssuer(String)orActionTestingSupport.OUTBOUND_MSG_ISSUERif none is given - the activation criteria is
Predicates.alwaysTrue() - the profile configurations provided
setRelyingPartyProfileConfigurations(Collection)or oneMockProfileConfigurationif none is provided
- Returns:
- the constructed
RelyingPartyConfiguration - Throws:
ComponentInitializationException- ...
-
selectProfileConfiguration
@Nullable protected ProfileConfiguration selectProfileConfiguration(@Nonnull Map<String, ProfileConfiguration> rpProfileConfigs) Selects the active profile configurations from the set of registered profile configuration from the relying party configuration built bybuildRelyingPartyConfiguration(). The default implementation of this method simply returns the first value of theMap.values()collection.- Parameters:
rpProfileConfigs- the set of profile configurations associated with the constructed relying party- Returns:
- the active
ProfileConfiguration
-