Class HTTPPostEncoder

All Implemented Interfaces:
Component, DestructableComponent, InitializableComponent, UnmodifiableComponent, MessageEncoder, HttpServletResponseMessageEncoder, SAMLMessageEncoder
Direct Known Subclasses:
HTTPPostSimpleSignEncoder

public class HTTPPostEncoder extends BaseSAML2MessageEncoder
SAML 2.0 HTTP Post binding message encoder.
  • Field Details

    • DEFAULT_TEMPLATE_ID

      @Nonnull @NotEmpty public static final String DEFAULT_TEMPLATE_ID
      Default template ID.
      See Also:
    • log

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

      @NonnullAfterInit private org.apache.velocity.app.VelocityEngine velocityEngine
      Velocity engine used to evaluate the template when performing POST encoding.
    • velocityTemplateId

      @Nonnull private String velocityTemplateId
      ID of the Velocity template used when performing POST encoding.
  • Constructor Details

    • HTTPPostEncoder

      public HTTPPostEncoder()
      Constructor.
  • Method Details

    • getBindingURI

      @Nonnull @NotEmpty public String getBindingURI()
    • getVelocityEngine

      @NonnullAfterInit public org.apache.velocity.app.VelocityEngine getVelocityEngine()
      Get the VelocityEngine instance.
      Returns:
      return the VelocityEngine instance
    • setVelocityEngine

      public void setVelocityEngine(@Nullable org.apache.velocity.app.VelocityEngine newVelocityEngine)
      Set the VelocityEngine instance.
      Parameters:
      newVelocityEngine - the new VelocityEngine instane
    • getVelocityTemplateId

      @Nonnull @NotEmpty public String getVelocityTemplateId()
      Get the Velocity template id.

      Defaults to DEFAULT_TEMPLATE_ID.

      Returns:
      return the Velocity template id
    • setVelocityTemplateId

      public void setVelocityTemplateId(@Nonnull @NotEmpty String newVelocityTemplateId)
      Set the Velocity template id.

      Defaults to DEFAULT_TEMPLATE_ID.

      Parameters:
      newVelocityTemplateId - the new Velocity template id
    • doInitialize

      protected void doInitialize() throws ComponentInitializationException
      Overrides:
      doInitialize in class AbstractHttpServletResponseMessageEncoder
      Throws:
      ComponentInitializationException
    • doEncode

      protected void doEncode() throws MessageEncodingException
      Specified by:
      doEncode in class AbstractMessageEncoder
      Throws:
      MessageEncodingException
    • postEncode

      protected void postEncode(@Nonnull MessageContext messageContext, @Nonnull String endpointURL) throws MessageEncodingException
      Base64 and POST encodes the outbound message and writes it to the outbound transport.
      Parameters:
      messageContext - current message context
      endpointURL - endpoint URL to which to encode message
      Throws:
      MessageEncodingException - thrown if there is a problem encoding the message
    • populateVelocityContext

      protected void populateVelocityContext(@Nonnull org.apache.velocity.VelocityContext velocityContext, @Nonnull MessageContext messageContext, @Nonnull String endpointURL) throws MessageEncodingException
      Populate the Velocity context instance which will be used to render the POST body.
      Parameters:
      velocityContext - the Velocity context instance to populate with data
      messageContext - the SAML message context source of data
      endpointURL - endpoint URL to which to encode message
      Throws:
      MessageEncodingException - thrown if there is a problem encoding the message