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

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

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

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

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

    • HTTPPostEncoder

      public HTTPPostEncoder()
      Constructor.
  • Method Details

    • getBindingURI

      public String getBindingURI()
      Gets the SAML binding URI supported by this encoder.
      Returns:
      SAML binding URI supported by this encoder
    • getVelocityEngine

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

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

      public String getVelocityTemplateId()
      Get the Velocity template id.

      Defaults to DEFAULT_TEMPLATE_ID.

      Returns:
      return the Velocity template id
    • setVelocityTemplateId

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

      Defaults to DEFAULT_TEMPLATE_ID.

      Parameters:
      newVelocityTemplateId - the new Velocity template id
    • doDestroy

      protected void doDestroy()
      Overrides:
      doDestroy in class AbstractHttpServletResponseMessageEncoder
    • doInitialize

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

      protected void doEncode() throws MessageEncodingException
      Performs the encoding logic. By the time this is called, this encoder has already been initialized and checked to ensure that it has not been destroyed.
      Specified by:
      doEncode in class AbstractMessageEncoder
      Throws:
      MessageEncodingException - thrown if there is a problem encoding the message
    • postEncode

      protected void postEncode(MessageContext messageContext, 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(org.apache.velocity.VelocityContext velocityContext, MessageContext messageContext, 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