org.opensaml.saml2.binding.encoding
Class HTTPArtifactEncoder

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.saml2.binding.encoding.AbstractSAML2HTTPMessageEncoder
              extended by org.opensaml.saml2.binding.encoding.HTTPArtifactEncoder
All Implemented Interfaces:
HTTPMessageEncoder, MessageEncoder<javax.servlet.http.HttpServletResponse>

public class HTTPArtifactEncoder
extends AbstractSAML2HTTPMessageEncoder

SAML 2 Artifact Binding encoder, support both HTTP GET and POST.


Nested Class Summary
static class HTTPArtifactEncoder.ENCODING_METHOD
          Artifact encoding methods.
 
Constructor Summary
HTTPArtifactEncoder()
           
 
Method Summary
 void encode()
          Encode the SAML message in the binding specific manner.
protected  void generateArtifact()
          Generates the artifact to use and maps the given SAML message to it.
 SAMLArtifact getArtifact()
          Gets the artifact created for the given SAML message.
 SAMLArtifactFactory getArtifactFactory()
          Gets the artifact factory used to create artifacts for this encoder.
 SAMLArtifactMap getArtifactMap()
          Gets the artifact map used to map artifacts and messages.
 byte[] getArtifactType()
          Gets the type of artifact this encoder will use.
 java.lang.String getBindingURI()
          Gets the binding URI supported by this encoder.
protected  void getEncode(java.lang.String artifactString)
          Performs HTTP GET based econding.
 HTTPArtifactEncoder.ENCODING_METHOD getEncodingMethod()
          Gets the HTTP submit method to use.
 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.lang.String artifactString)
          Performs HTTP POST based encoding.
 void setArtifactFactory(SAMLArtifactFactory factory)
          Sets the artifact factory used to create artifacts for this encoder.
 void setArtifactMap(SAMLArtifactMap map)
          Sets the artifact map used to map artifacts and messages.
 void setArtifactType(byte[] type)
          Sets the type of artifact this encoder will use.
 void setEncodingMethod(HTTPArtifactEncoder.ENCODING_METHOD method)
          Sets the HTTP submit method to use.
 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.
 
Methods inherited from class org.opensaml.saml2.binding.encoding.AbstractSAML2HTTPMessageEncoder
checkRelayState, getEndpointURL, signMessage
 
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
 

Constructor Detail

HTTPArtifactEncoder

public HTTPArtifactEncoder()
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

getEncodingMethod

public HTTPArtifactEncoder.ENCODING_METHOD getEncodingMethod()
Gets the HTTP submit method to use.

Returns:
HTTP submit method to use

setEncodingMethod

public void setEncodingMethod(HTTPArtifactEncoder.ENCODING_METHOD method)
Sets the HTTP submit method to use.

Parameters:
method - HTTP submit method to use

getArtifactFactory

public SAMLArtifactFactory getArtifactFactory()
Gets the artifact factory used to create artifacts for this encoder.

Returns:
artifact factory used to create artifacts for this encoder

setArtifactFactory

public void setArtifactFactory(SAMLArtifactFactory factory)
Sets the artifact factory used to create artifacts for this encoder.

Parameters:
factory - artifact factory used to create artifacts for this encoder

getArtifactMap

public SAMLArtifactMap getArtifactMap()
Gets the artifact map used to map artifacts and messages.

Returns:
artifact map used to map artifacts and messages

setArtifactMap

public void setArtifactMap(SAMLArtifactMap map)
Sets the artifact map used to map artifacts and messages.

Parameters:
map - artifact map used to map artifacts and messages

getArtifactType

public byte[] getArtifactType()
Gets the type of artifact this encoder will use.

Returns:
type of artifact this encoder will use

setArtifactType

public void setArtifactType(byte[] type)
Sets the type of artifact this encoder will use.

Parameters:
type - type of artifact this encoder will use

getArtifact

public SAMLArtifact getArtifact()
Gets the artifact created for the given SAML message.

Returns:
artifact created for the given SAML message

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.lang.String artifactString)
                   throws BindingException
Performs HTTP POST based encoding.

Parameters:
artifactString - the base64 encoded artifact
Throws:
BindingException - thrown if there is a problem invoking the velocity template to create the form

getEncode

protected void getEncode(java.lang.String artifactString)
                  throws BindingException
Performs HTTP GET based econding.

Parameters:
artifactString - the base64 encoded artifact
Throws:
BindingException - thrown if there is a problem redirecting the response

generateArtifact

protected void generateArtifact()
                         throws BindingException
Generates the artifact to use and maps the given SAML message to it.

Throws:
BindingException - thrown if the artifact can not be created