org.opensaml.saml1.binding.encoding
Class HTTPPostEncoder

java.lang.Object
  extended by org.opensaml.common.binding.encoding.impl.AbstractMessageEncoder<javax.servlet.http.HttpServletResponse>
      extended by org.opensaml.common.binding.encoding.impl.AbstractHTTPMessageEncoder
          extended by org.opensaml.saml1.binding.encoding.HTTPPostEncoder
All Implemented Interfaces:
HTTPMessageEncoder, MessageEncoder<javax.servlet.http.HttpServletResponse>

public class HTTPPostEncoder
extends AbstractHTTPMessageEncoder

SAML 1.X HTTP POST message encoder.


Field Summary
static java.lang.String BINDING_URI
          Binding URI.
 
Constructor Summary
HTTPPostEncoder()
           
 
Method Summary
 void encode()
          Encode the SAML message in the binding specific manner.
 java.lang.String getBindingURI()
          Gets the binding URI supported by this encoder.
protected  java.lang.String getEndpointURL()
          Gets the response URL from the relying party endpoint.
 org.apache.velocity.app.VelocityEngine getVelocityEngine()
          Gets the velocity engine used to evaluate the template when performing POST encoding.
 java.lang.String getVelocityTemplateId()
          Gets the ID of the velocity template used for POST encoding.
protected  void postEncode(java.io.Writer responseWriter, java.lang.String message)
          POST encodes the SAML message.
 void setVelocityEngine(org.apache.velocity.app.VelocityEngine engine)
          Sets the velocity engine used to evaluate the template when performing POST encoding.
 void setVelocityTemplateId(java.lang.String id)
          Sets the ID of the velocity template used for POST encoding.
protected  void signMessage()
          Signs the given SAML message if it a SignableSAMLObject and this encoder has signing credentials.
 
Methods inherited from class org.opensaml.common.binding.encoding.impl.AbstractHTTPMessageEncoder
getBase64EncodedMessage, getEncodeRelayState, getRelayState, initializeResponse, setRelayState
 
Methods inherited from class org.opensaml.common.binding.encoding.impl.AbstractMessageEncoder
getIssuer, getMetadataProvider, getRelyingParty, getRelyingPartyEndpoint, getRelyingPartyRole, getResponse, getSamlMessage, getSigningCredential, marshallMessage, setIssuer, setMetadataProvider, setRelyingParty, setRelyingPartyEndpoint, setRelyingPartyRole, setResponse, setSamlMessage, setSigningCredential
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensaml.common.binding.encoding.MessageEncoder
getIssuer, getMetadataProvider, getRelyingParty, getRelyingPartyEndpoint, getRelyingPartyRole, getResponse, getSamlMessage, getSigningCredential, setIssuer, setMetadataProvider, setRelyingParty, setRelyingPartyEndpoint, setRelyingPartyRole, setResponse, setSamlMessage, setSigningCredential
 

Field Detail

BINDING_URI

public static final java.lang.String BINDING_URI
Binding URI.

See Also:
Constant Field Values
Constructor Detail

HTTPPostEncoder

public HTTPPostEncoder()
Method Detail

getBindingURI

public java.lang.String getBindingURI()
Gets the binding URI supported by this encoder.

Returns:
binding URI supported by this encoder

getVelocityEngine

public org.apache.velocity.app.VelocityEngine getVelocityEngine()
Gets the velocity engine used to evaluate the template when performing POST encoding.

Returns:
velocity engine used to evaluate the template when performing POST encoding

setVelocityEngine

public void setVelocityEngine(org.apache.velocity.app.VelocityEngine engine)
Sets the velocity engine used to evaluate the template when performing POST encoding.

Parameters:
engine - velocity engine used to evaluate the template when performing POST encoding

getVelocityTemplateId

public java.lang.String getVelocityTemplateId()
Gets the ID of the velocity template used for POST encoding.

Returns:
ID of the velocity template used for POST encoding

setVelocityTemplateId

public void setVelocityTemplateId(java.lang.String id)
Sets the ID of the velocity template used for POST encoding.

Parameters:
id - ID of the velocity template used for POST encoding

encode

public void encode()
            throws BindingException
Encode the SAML message in the binding specific manner.

Throws:
BindingException - thrown if the problem can not be encoded

postEncode

protected void postEncode(java.io.Writer responseWriter,
                          java.lang.String message)
                   throws BindingException
POST encodes the SAML message.

Parameters:
responseWriter - writer to write the encoded message to
message - base64 encoded SAML message
Throws:
BindingException - thrown if the message can not be written to the writer

getEndpointURL

protected java.lang.String getEndpointURL()
                                   throws BindingException
Gets the response URL from the relying party endpoint. If the SAML message is a Response and the relying party endpoint contains a response location then that location is returned otherwise the normal endpoint location is returned.

Returns:
response URL from the relying party endpoint
Throws:
BindingException - throw if no relying party endpoint is available

signMessage

protected void signMessage()
Signs the given SAML message if it a SignableSAMLObject and this encoder has signing credentials.