Package org.opensaml.saml.common.binding.impl

# Class BaseSAMLHttpServletRequestDecoder

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.messaging.decoder.AbstractMessageDecoder
org.opensaml.messaging.decoder.servlet.AbstractHttpServletRequestMessageDecoder
org.opensaml.messaging.decoder.servlet.BaseHttpServletRequestXMLMessageDecoder
org.opensaml.saml.common.binding.impl.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 Summary

Fields
Modifier and Type
Field
Description
`private final org.slf4j.Logger`
`log`
Logger.
`private MessageType`
`messageType`
Cached message type.

### Fields inherited from class org.opensaml.messaging.decoder.AbstractMessageDecoder

`BASE_PROTOCOL_MESSAGE_LOGGER_CATEGORY`

## Constructor Summary

Constructors
Constructor
Description
`BaseSAMLHttpServletRequestDecoder()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`evaluateMessageSizeLimit()`
Enforce the configured message size limit, if enabled.
`protected Integer`
`getMessageSize()`
Get the message size in bytes.
`protected Integer`
`getMessageSizeLimit()`
Get the configured message size limit, in bytes.
`protected MessageType`
`getMessageType()`
Get the type of message being processed by the decoder.
`protected boolean`
`isEnforceMessageSizeLimit()`
Get whether enforcement of message size limit is enabled.
`protected Integer`
`validateAndGetMessageSize()`
Validate message parameter values and return the message size in bytes.
`protected void`
`validateHttpRequest(HttpServletRequest request)`
Perform optional validation of the inbound `HttpServletRequest`.

### Methods inherited from class org.opensaml.messaging.decoder.servlet.BaseHttpServletRequestXMLMessageDecoder

`decode, doInitialize, getParserPool, serializeMessageForLogging, setParserPool, unmarshallMessage`

### Methods inherited from class org.opensaml.messaging.decoder.servlet.AbstractHttpServletRequestMessageDecoder

`getHttpServletRequest, getHttpServletRequestSupplier, isCheckDuringInit, setCheckDuringInit, setHttpServletRequestSupplier`

### Methods inherited from class org.opensaml.messaging.decoder.AbstractMessageDecoder

`doDecode, getMessageContext, getMessageToLog, getProtocolMessageLogger, getProtocolMessageLoggerSubCategory, logDecodedMessage, setMessageContext, setProtocolMessageLoggerSubCategory`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, 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.shared.component.DestructableComponent

`destroy, isDestroyed`

### Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

`initialize, isInitialized`

### Methods inherited from interface org.opensaml.messaging.decoder.MessageDecoder

`getMessageContext`

## 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