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
public class AddStatusToResponse extends AbstractProfileAction
Action that setsStatuscontent in aStatusResponseTypeobtained 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
StatusMessageeither explicitly, or via lookup strategy.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAddStatusToResponse.StatusCodeMappingFunctionA default method to map event IDs to SAML 2 StatusCode URIs based onEventContext.
-
Field Summary
Fields Modifier and Type Field Description private List<String>defaultStatusCodesOne or more status codes to insert.private booleandetailedErrorsWhether to include detailed status information.private Predicate<ProfileRequestContext>detailedErrorsConditionPredicate determining whether detailed error information is permitted.private org.slf4j.LoggerlogClass logger.private StatusResponseTyperesponseResponse to modify.private Function<ProfileRequestContext,StatusResponseType>responseLookupStrategyStrategy used to locate theStatusResponseTypeto operate on.private Function<ProfileRequestContext,List<String>>statusCodesLookupStrategyOptional method to obtain status codes.private StringstatusMessageA default status message to include.private Function<ProfileRequestContext,String>statusMessageLookupStrategyOptional method to obtain a status message.
-
Constructor Summary
Constructors Constructor Description AddStatusToResponse()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidbuildStatusCode(Status status, List<String> codes)Build and attachStatusCodeelement.private voidbuildStatusMessage(Status status, String message)Build and attachStatusMessageelement.protected voiddoExecute(ProfileRequestContext profileRequestContext)protected booleandoPreExecute(ProfileRequestContext profileRequestContext)voidsetDetailedErrorsCondition(Predicate<ProfileRequestContext> condition)Set the predicate used to determine the detailed errors condition.voidsetResponseLookupStrategy(Function<ProfileRequestContext,StatusResponseType> strategy)Set the strategy used to locate theStatusResponseTypeto operate on.voidsetStatusCodes(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.voidsetStatusCodesLookupStrategy(Function<ProfileRequestContext,List<String>> strategy)Set the optional strategy used to obtain status codes to include.voidsetStatusMessage(String message)Set a default status message to use in the event that error detail is off, or no specific message is obtained.voidsetStatusMessageLookupStrategy(Function<ProfileRequestContext,String> strategy)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, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, setHttpServletRequest, setHttpServletRequestSupplier, setHttpServletResponse, setHttpServletResponseSupplier
-
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 Detail
-
log
@Nonnull private org.slf4j.Logger log
Class logger.
-
responseLookupStrategy
@Nonnull private Function<ProfileRequestContext,StatusResponseType> responseLookupStrategy
Strategy used to locate theStatusResponseTypeto operate on.
-
detailedErrorsCondition
@Nonnull private Predicate<ProfileRequestContext> detailedErrorsCondition
Predicate determining whether detailed error information is permitted.
-
statusCodesLookupStrategy
@Nullable private Function<ProfileRequestContext,List<String>> statusCodesLookupStrategy
Optional method to obtain status codes.
-
statusMessageLookupStrategy
@Nullable private Function<ProfileRequestContext,String> statusMessageLookupStrategy
Optional method to obtain a status message.
-
defaultStatusCodes
@Nonnull @NonnullElements private List<String> defaultStatusCodes
One or more status codes to insert.
-
statusMessage
@Nullable private String statusMessage
A default status message to include.
-
detailedErrors
private boolean detailedErrors
Whether to include detailed status information.
-
response
@Nullable private StatusResponseType response
Response to modify.
-
-
Method Detail
-
setResponseLookupStrategy
public void setResponseLookupStrategy(@Nonnull Function<ProfileRequestContext,StatusResponseType> strategy)Set the strategy used to locate theStatusResponseTypeto operate on.- Parameters:
strategy- strategy used to locate theStatusResponseTypeto operate on
-
setDetailedErrorsCondition
public void setDetailedErrorsCondition(@Nonnull Predicate<ProfileRequestContext> condition)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
public void setStatusCodes(@Nonnull @NonnullElements 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.- Parameters:
codes- list of status code values to insert
-
setStatusMessage
public void setStatusMessage(@Nullable String message)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
protected boolean doPreExecute(@Nonnull ProfileRequestContext profileRequestContext)- Overrides:
doPreExecutein classAbstractProfileAction
-
doExecute
protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext)- Overrides:
doExecutein classAbstractProfileAction
-
buildStatusCode
private void buildStatusCode(@Nonnull Status status, @Nonnull @NonnullElements List<String> codes)Build and attachStatusCodeelement.- Parameters:
status- the element to attach tocodes- the status codes to use
-
buildStatusMessage
private void buildStatusMessage(@Nonnull Status status, @Nonnull @NotEmpty String message)Build and attachStatusMessageelement.- Parameters:
status- the element to attach tomessage- the message to set
-
-