Package org.opensaml.saml.saml2.binding.decoding.impl

# Class HTTPRedirectDeflateDecoder

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
org.opensaml.saml.saml2.binding.decoding.impl.HTTPRedirectDeflateDecoder

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `InitializableComponent`, `UnmodifiableComponent`, `MessageDecoder`, `HttpServletRequestMessageDecoder`, `SAMLMessageDecoder`

public class HTTPRedirectDeflateDecoder extends BaseSAMLHttpServletRequestDecoder implements SAMLMessageDecoder
SAML 2.0 HTTP Redirect decoder using the DEFLATE encoding method. This decoder only supports DEFLATE compression.

## Field Summary

Fields
Modifier and Type
Field
Description
`private BindingDescriptor`
`bindingDescriptor`
Optional `BindingDescriptor` to inject into `SAMLBindingContext` created.
`private final org.slf4j.Logger`
`log`
Class logger.

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

`BASE_PROTOCOL_MESSAGE_LOGGER_CATEGORY`

## Constructor Summary

Constructors
Constructor
Description
`HTTPRedirectDeflateDecoder()`

## Method Summary

Modifier and Type
Method
Description
`private boolean`
`appendParameter(StringBuilder builder, String queryString, String paramName)`
Find the raw query string parameter indicated and append it to the string builder.
`private boolean`
`appendSAMLMessageParameter(StringBuilder builder, String queryString, String paramName, String paramValue)`
Find the raw query string parameter indicated and append it to the string builder.
`private String`
`buildSignedContentString(String queryString, String samlMessageParamName, String samlMessage)`
Extract the raw request parameters and build a string representation of the content that was signed.
`protected InputStream`
`decodeMessage(String message)`
Base64 decodes the SAML message and then decompresses the message.
`protected void`
`doDecode()`
Performs the decoding logic.
`BindingDescriptor`
`getBindingDescriptor()`
Get an optional `BindingDescriptor` to inject into `SAMLBindingContext` created.
`String`
`getBindingURI()`
Gets the SAML binding URI supported by this decoder.
`protected Integer`
`getMessageSize()`
Get the message size in bytes.
`private byte[]`
`getSignedContent(String samlMessageParamName, String samlMessage)`
Get the signed content data.
`protected void`
`populateBindingContext(MessageContext messageContext)`
Populate the context which carries information specific to this binding.
`protected void`
`populateSimpleSignatureContext(MessageContext messageContext, String samlMessageParamName, String samlMessage)`
Build signed content string and populate the `SimpleSignatureContext`.
`void`
`setBindingDescriptor(BindingDescriptor descriptor)`
Set an optional `BindingDescriptor` to inject into `SAMLBindingContext` created.

### Methods inherited from class org.opensaml.saml.common.binding.impl.BaseSAMLHttpServletRequestDecoder

`evaluateMessageSizeLimit, getMessageSizeLimit, getMessageType, isEnforceMessageSizeLimit, validateAndGetMessageSize, validateHttpRequest`

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

`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

`decode, getMessageContext`

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### bindingDescriptor

@Nullable private BindingDescriptor bindingDescriptor
Optional `BindingDescriptor` to inject into `SAMLBindingContext` created.

## Constructor Details

### HTTPRedirectDeflateDecoder

public HTTPRedirectDeflateDecoder()

## Method Details

### getBindingURI

@Nonnull @NotEmpty public String getBindingURI()
Gets the SAML binding URI supported by this decoder.

Specified by:
  `getBindingURI` in interface `SAMLMessageDecoder`
Returns:
  SAML binding URI supported by this decoder

### getBindingDescriptor

@Nullable public BindingDescriptor getBindingDescriptor()
Get an optional `BindingDescriptor` to inject into `SAMLBindingContext` created.

Returns:
  binding descriptor

### setBindingDescriptor

public void setBindingDescriptor(@Nullable BindingDescriptor descriptor)
Set an optional `BindingDescriptor` to inject into `SAMLBindingContext` created.

Parameters:
  `descriptor` - a binding descriptor

### doDecode

protected void doDecode() throws MessageDecodingException
Performs the decoding logic. By the time this is called, this decoder has already been initialized and checked to ensure that it has not been destroyed.

Specified by:
  `doDecode` in class `AbstractMessageDecoder`
Throws:
  `MessageDecodingException` - thrown if there is a problem decoding the message

### populateSimpleSignatureContext

protected void populateSimpleSignatureContext(@Nonnull MessageContext messageContext, @Nonnull String samlMessageParamName, @Nonnull String samlMessage) throws MessageDecodingException
Build signed content string and populate the `SimpleSignatureContext`.

Parameters:
  `messageContext` - the current message context
  `samlMessageParamName` - the URL-decoded SAML message parameter name
  `samlMessage` - the URL-decoded Base64-encoded SAML message data
Throws:
  `MessageDecodingException` - if there is a fatal issue building the signed content

### getSignedContent

@Nullable private byte[] getSignedContent(@Nonnull String samlMessageParamName, @Nonnull String samlMessage) throws MessageDecodingException
Get the signed content data.

Parameters:
  `samlMessageParamName` - the URL-decoded SAML message parameter name
  `samlMessage` - the URL-decoded Base64-encoded SAML message data
Returns:
  the signed content
Throws:
  `MessageDecodingException` - if there is a fatal issue building the signed content

### buildSignedContentString

@Nullable @NotEmpty private String buildSignedContentString(@Nullable String queryString, @Nonnull String samlMessageParamName, @Nonnull String samlMessage) throws MessageDecodingException
Extract the raw request parameters and build a string representation of the content that was signed.

Parameters:
  `queryString` - the raw HTTP query string from the request
  `samlMessageParamName` - the URL-decoded SAML message parameter name
  `samlMessage` - the URL-decoded Base64-encoded SAML message data
Returns:
  a string representation of the signed content
Throws:
  `MessageDecodingException` - thrown if there is an error during request processing

### appendSAMLMessageParameter

private boolean appendSAMLMessageParameter(@Nonnull StringBuilder builder, @Nullable String queryString, @Nonnull String paramName, @Nonnull String paramValue)
Find the raw query string parameter indicated and append it to the string builder. The appended value will be in the form 'paramName=paramValue' (minus the quotes).

Parameters:
  `builder` - string builder to which to append the parameter
  `queryString` - the URL query string containing parameters
  `paramName` - the name of the SAML message parameter to append
  `paramValue` - the value of the SAML message parameter to append
Returns:
  true if parameter was found, false otherwise

### appendParameter

private boolean appendParameter(@Nonnull StringBuilder builder, @Nullable String queryString, @Nullable String paramName)
Find the raw query string parameter indicated and append it to the string builder. The appended value will be in the form 'paramName=paramValue' (minus the quotes).

Parameters:
  `builder` - string builder to which to append the parameter
  `queryString` - the URL query string containing parameters
  `paramName` - the name of the parameter to append
Returns:
  true if parameter was found, false otherwise

### decodeMessage

@Nonnull protected InputStream decodeMessage(@Nonnull String message) throws MessageDecodingException
Base64 decodes the SAML message and then decompresses the message.

Parameters:
  `message` - Base64 encoded, DEFALTE compressed, SAML message
Returns:
  the SAML message
Throws:
  `MessageDecodingException` - thrown if the message can not be decoded

### populateBindingContext

protected void populateBindingContext(@Nonnull MessageContext messageContext)
Populate the context which carries information specific to this binding.

Parameters:
  `messageContext` - the current message context

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

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