Class AddStatusToResponse
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
org.opensaml.profile.action.AbstractProfileAction
org.opensaml.saml.saml2.profile.impl.AddStatusToResponse
- All Implemented Interfaces:
Component
,DestructableComponent
,InitializableComponent
,ProfileAction
Action that sets
Status
content in a StatusResponseType
obtained from
a lookup strategy, typically from the outbound message context.
If the message already contains status information, this action will overwrite it.
Options allows for the creation of a StatusMessage
either explicitly,
or via lookup strategy.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A default method to map event IDs to SAML 2 StatusCode URIs based onEventContext
. -
Field Summary
FieldsModifier and TypeFieldDescriptionOne or more status codes to insert.private boolean
Whether to include detailed status information.private Predicate<ProfileRequestContext>
Predicate determining whether detailed error information is permitted.private org.slf4j.Logger
Class logger.private StatusResponseType
Response to modify.Strategy used to locate theStatusResponseType
to operate on.private Function<ProfileRequestContext,
List<String>> Optional method to obtain status codes.private String
A default status message to include.private Function<ProfileRequestContext,
String> Optional method to obtain a status message. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
buildStatusCode
(Status status, List<String> codes) Build and attachStatusCode
element.private void
buildStatusMessage
(Status status, String message) Build and attachStatusMessage
element.protected void
doExecute
(ProfileRequestContext profileRequestContext) Performs this action.protected boolean
doPreExecute
(ProfileRequestContext profileRequestContext) Called prior to execution, actions may override this method to perform pre-processing for a request.void
setDetailedErrorsCondition
(Predicate<ProfileRequestContext> condition) Set the predicate used to determine the detailed errors condition.void
Set the strategy used to locate theStatusResponseType
to operate on.void
setStatusCodes
(List<String> codes) Set the list of status code values to insert, ordered such that the top level code is first and every other code will be nested inside the previous one.void
Set the optional strategy used to obtain status codes to include.void
setStatusMessage
(String message) Set a default status message to use in the event that error detail is off, or no specific message is obtained.void
Set the optional strategy used to obtain a status message to include.Methods inherited from class org.opensaml.profile.action.AbstractProfileAction
doPostExecute, doPostExecute, execute, getHttpServletRequest, getHttpServletResponse, getLogPrefix, setHttpServletRequest, setHttpServletResponse
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, doInitialize, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
log
@Nonnull private org.slf4j.Logger logClass logger. -
responseLookupStrategy
Strategy used to locate theStatusResponseType
to operate on. -
detailedErrorsCondition
Predicate determining whether detailed error information is permitted. -
statusCodesLookupStrategy
Optional method to obtain status codes. -
statusMessageLookupStrategy
Optional method to obtain a status message. -
defaultStatusCodes
One or more status codes to insert. -
statusMessage
A default status message to include. -
detailedErrors
private boolean detailedErrorsWhether to include detailed status information. -
response
Response to modify.
-
-
Constructor Details
-
AddStatusToResponse
public AddStatusToResponse()Constructor.
-
-
Method Details
-
setResponseLookupStrategy
public void setResponseLookupStrategy(@Nonnull Function<ProfileRequestContext, StatusResponseType> strategy) Set the strategy used to locate theStatusResponseType
to operate on.- Parameters:
strategy
- strategy used to locate theStatusResponseType
to operate on
-
setDetailedErrorsCondition
Set the predicate used to determine the detailed errors condition.- Parameters:
condition
- predicate for detailed errors condition
-
setStatusCodesLookupStrategy
public void setStatusCodesLookupStrategy(@Nullable Function<ProfileRequestContext, List<String>> strategy) Set the optional strategy used to obtain status codes to include.- Parameters:
strategy
- strategy used to obtain status codes
-
setStatusMessageLookupStrategy
public void setStatusMessageLookupStrategy(@Nullable Function<ProfileRequestContext, String> strategy) Set the optional strategy used to obtain a status message to include.- Parameters:
strategy
- strategy used to obtain a status message
-
setStatusCodes
Set the list of status code values to insert, ordered such that the top level code is first and every other code will be nested inside the previous one.- Parameters:
codes
- list of status code values to insert
-
setStatusMessage
Set a default status message to use in the event that error detail is off, or no specific message is obtained.- Parameters:
message
- default status message
-
doPreExecute
Called prior to execution, actions may override this method to perform pre-processing for a request.If false is returned, execution will not proceed, and the action should attach an
EventContext
to the context tree to signal how to continue with overall workflow processing.If returning successfully, the last step should be to return the result of the superclass version of this method.
- Overrides:
doPreExecute
in classAbstractProfileAction
- Parameters:
profileRequestContext
- the current IdP profile request context- Returns:
- true iff execution should proceed
-
doExecute
Performs this action. Actions must override this method to perform their work.- Overrides:
doExecute
in classAbstractProfileAction
- Parameters:
profileRequestContext
- the current IdP profile request context
-
buildStatusCode
Build and attachStatusCode
element.- Parameters:
status
- the element to attach tocodes
- the status codes to use
-
buildStatusMessage
Build and attachStatusMessage
element.- Parameters:
status
- the element to attach tomessage
- the message to set
-