Class AddStatusToResponse

  • All Implemented Interfaces:
    net.shibboleth.utilities.java.support.component.Component, net.shibboleth.utilities.java.support.component.DestructableComponent, net.shibboleth.utilities.java.support.component.InitializableComponent, org.opensaml.profile.action.ProfileAction

    public class AddStatusToResponse
    extends org.opensaml.profile.action.AbstractProfileAction
    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.

    Event:
    EventIds.PROCEED_EVENT_ID, EventIds.INVALID_MSG_CTX
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void buildStatusCode​(org.opensaml.saml.saml2.core.Status status, List<String> codes)
      Build and attach StatusCode element.
      private void buildStatusMessage​(org.opensaml.saml.saml2.core.Status status, String message)
      Build and attach StatusMessage element.
      protected void doExecute​(org.opensaml.profile.context.ProfileRequestContext profileRequestContext)
      protected boolean doPreExecute​(org.opensaml.profile.context.ProfileRequestContext profileRequestContext)
      void setDetailedErrorsCondition​(Predicate<org.opensaml.profile.context.ProfileRequestContext> condition)
      Set the predicate used to determine the detailed errors condition.
      void setResponseLookupStrategy​(Function<org.opensaml.profile.context.ProfileRequestContext,​org.opensaml.saml.saml2.core.StatusResponseType> strategy)
      Set the strategy used to locate the StatusResponseType 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 setStatusCodesLookupStrategy​(Function<org.opensaml.profile.context.ProfileRequestContext,​List<String>> strategy)
      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 setStatusMessageLookupStrategy​(Function<org.opensaml.profile.context.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, getHttpServletResponse, getLogPrefix, setHttpServletRequest, setHttpServletResponse
      • Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent

        destroy, doDestroy, doInitialize, initialize, isDestroyed, isInitialized
      • Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent

        initialize, isInitialized
    • Field Detail

      • log

        @Nonnull
        private Logger log
        Class logger.
      • responseLookupStrategy

        @Nonnull
        private Function<org.opensaml.profile.context.ProfileRequestContext,​org.opensaml.saml.saml2.core.StatusResponseType> responseLookupStrategy
        Strategy used to locate the StatusResponseType to operate on.
      • detailedErrorsCondition

        @Nonnull
        private Predicate<org.opensaml.profile.context.ProfileRequestContext> detailedErrorsCondition
        Predicate determining whether detailed error information is permitted.
      • statusCodesLookupStrategy

        @Nullable
        private Function<org.opensaml.profile.context.ProfileRequestContext,​List<String>> statusCodesLookupStrategy
        Optional method to obtain status codes.
      • statusMessageLookupStrategy

        @Nullable
        private Function<org.opensaml.profile.context.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 org.opensaml.saml.saml2.core.StatusResponseType response
        Response to modify.
    • Constructor Detail

      • AddStatusToResponse

        public AddStatusToResponse()
        Constructor.
    • Method Detail

      • setResponseLookupStrategy

        public void setResponseLookupStrategy​(@Nonnull
                                              Function<org.opensaml.profile.context.ProfileRequestContext,​org.opensaml.saml.saml2.core.StatusResponseType> strategy)
        Set the strategy used to locate the StatusResponseType to operate on.
        Parameters:
        strategy - strategy used to locate the StatusResponseType to operate on
      • setDetailedErrorsCondition

        public void setDetailedErrorsCondition​(@Nonnull
                                               Predicate<org.opensaml.profile.context.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<org.opensaml.profile.context.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<org.opensaml.profile.context.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
                                       org.opensaml.profile.context.ProfileRequestContext profileRequestContext)
        Overrides:
        doPreExecute in class org.opensaml.profile.action.AbstractProfileAction
      • doExecute

        protected void doExecute​(@Nonnull
                                 org.opensaml.profile.context.ProfileRequestContext profileRequestContext)
        Overrides:
        doExecute in class org.opensaml.profile.action.AbstractProfileAction
      • buildStatusCode

        private void buildStatusCode​(@Nonnull
                                     org.opensaml.saml.saml2.core.Status status,
                                     @Nonnull @NonnullElements
                                     List<String> codes)
        Build and attach StatusCode element.
        Parameters:
        status - the element to attach to
        codes - the status codes to use
      • buildStatusMessage

        private void buildStatusMessage​(@Nonnull
                                        org.opensaml.saml.saml2.core.Status status,
                                        @Nonnull @NotEmpty
                                        String message)
        Build and attach StatusMessage element.
        Parameters:
        status - the element to attach to
        message - the message to set