Class BaseSAMLHttpServletRequestDecoder

All Implemented Interfaces:
Component, DestructableComponent, InitializableComponent, UnmodifiableComponent, MessageDecoder, HttpServletRequestMessageDecoder
Direct Known Subclasses:
HTTPArtifactDecoder, HTTPArtifactDecoder, HTTPPostDecoder, HTTPPostDecoder, HTTPRedirectDeflateDecoder

public abstract class BaseSAMLHttpServletRequestDecoder extends BaseHttpServletRequestXMLMessageDecoder
Abstract base decoder for SAML decoders.
  • Field Details

    • log

      private final org.slf4j.Logger log
      Logger.
    • messageType

      private MessageType messageType
      Cached message type.
  • Constructor Details

    • BaseSAMLHttpServletRequestDecoder

      public BaseSAMLHttpServletRequestDecoder()
      Constructor.
  • Method Details

    • validateHttpRequest

      protected void validateHttpRequest(@Nonnull HttpServletRequest request) throws MessageDecodingException
      Perform optional validation of the inbound HttpServletRequest.

      This method is called before the main MessageDecoder.decode() logic}.

      The default behavior is a no-op. Subclasses may override with specific constraints.

      Overrides:
      validateHttpRequest in class BaseHttpServletRequestXMLMessageDecoder
      Parameters:
      request - the HTTP request being validate
      Throws:
      MessageDecodingException - if request is not considered valid
    • evaluateMessageSizeLimit

      protected void evaluateMessageSizeLimit() throws MessageDecodingException
      Enforce the configured message size limit, if enabled.
      Throws:
      MessageDecodingException - if message size exceeds the enabled and configured limit, or if evaluation encounters a fatal error
    • getMessageType

      @Nonnull protected MessageType getMessageType() throws MessageDecodingException
      Get the type of message being processed by the decoder.
      Returns:
      the message type
      Throws:
      MessageDecodingException - if the MessageType can not be determined
    • isEnforceMessageSizeLimit

      protected boolean isEnforceMessageSizeLimit() throws MessageDecodingException
      Get whether enforcement of message size limit is enabled.
      Returns:
      true if enabled, false if not
      Throws:
      MessageDecodingException - if there is a fatal error during evaluation
    • getMessageSizeLimit

      @Nullable protected Integer getMessageSizeLimit() throws MessageDecodingException
      Get the configured message size limit, in bytes.
      Returns:
      the message size limit in bytes, or null if not configured
      Throws:
      MessageDecodingException - if there is a fatal error during evaluation
    • validateAndGetMessageSize

      @Nullable protected Integer validateAndGetMessageSize() throws MessageDecodingException
      Validate message parameter values and return the message size in bytes.
      Returns:
      the message size in bytes, or null if can not be determined
      Throws:
      MessageDecodingException - if the HTTP request carries an invalid number of values for the specified message type
    • getMessageSize

      @Nullable protected Integer getMessageSize() throws MessageDecodingException
      Get the message size in bytes.

      The default implementation is to return null. Specific decoder implementation MUST implement this if message size limit enforcement is to be effectively enabled for that type of concrete decoder. Implementations may assume that the parameter set has already been validated and the request contains only 1 message parameter and 1 value for that parameter.

      Returns:
      the message size in bytes, or null if can not be determined
      Throws:
      MessageDecodingException - if there is a fatal error determining message size