org.opensaml.saml2.binding.encoding
Class HTTPArtifactEncoder

java.lang.Object
  extended by org.opensaml.ws.message.encoder.BaseMessageEncoder
      extended by org.opensaml.saml2.binding.encoding.BaseSAML2MessageEncoder
          extended by org.opensaml.saml2.binding.encoding.HTTPArtifactEncoder
All Implemented Interfaces:
SAMLMessageEncoder, MessageEncoder

public class HTTPArtifactEncoder
extends BaseSAML2MessageEncoder

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


Field Summary
private  SAMLArtifactMap artifactMap
          SAML artifact map used to store created artifacts for later retrieval.
private  byte[] defaultArtifactType
          Default artifact type to use when encoding messages.
private  org.slf4j.Logger log
          Class logger.
private  boolean postEncoding
          Whether the POST encoding should be used, instead of GET.
private  org.apache.velocity.app.VelocityEngine velocityEngine
          Velocity engine used to evaluate the template when performing POST encoding.
private  String velocityTemplateId
          ID of the velocity template used when performing POST encoding.
 
Constructor Summary
HTTPArtifactEncoder(org.apache.velocity.app.VelocityEngine engine, String template, SAMLArtifactMap map)
          Constructor.
 
Method Summary
protected  AbstractSAML2Artifact buildArtifact(SAMLMessageContext artifactContext)
          Builds the SAML 2 artifact for the outgoing message.
protected  void doEncode(MessageContext messageContext)
          
 String getBindingURI()
          Gets the SAML binding URI supported by this encoder.
protected  void getEncode(SAMLMessageContext artifactContext, HTTPOutTransport outTransport)
          Performs HTTP GET based encoding.
 boolean isPostEncoding()
          Gets whether the encoder will encode the artifact via POST encoding.
protected  void postEncode(SAMLMessageContext artifactContext, HTTPOutTransport outTransport)
          Performs HTTP POST based encoding.
 boolean providesMessageConfidentiality(MessageContext messageContext)
          
 boolean providesMessageIntegrity(MessageContext messageContext)
          
 void setPostEncoding(boolean post)
          Sets whether the encoder will encode the artifact via POST encoding.
 
Methods inherited from class org.opensaml.saml2.binding.encoding.BaseSAML2MessageEncoder
checkRelayState, getAllowedURLSchemes, getEndpointURL, setAllowedURLSchemes, setResponseDestination, signMessage
 
Methods inherited from class org.opensaml.ws.message.encoder.BaseMessageEncoder
encode, logEncodedMessage, marshallMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensaml.ws.message.encoder.MessageEncoder
encode
 

Field Detail

log

private final org.slf4j.Logger log
Class logger.


postEncoding

private boolean postEncoding
Whether the POST encoding should be used, instead of GET.


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.


artifactMap

private SAMLArtifactMap artifactMap
SAML artifact map used to store created artifacts for later retrieval.


defaultArtifactType

private byte[] defaultArtifactType
Default artifact type to use when encoding messages.

Constructor Detail

HTTPArtifactEncoder

public HTTPArtifactEncoder(org.apache.velocity.app.VelocityEngine engine,
                           String template,
                           SAMLArtifactMap map)
Constructor.

Parameters:
engine - velocity engine used to construct the POST form
template - ID of velocity template used to construct the POST form
map - artifact map used to store artifact/message bindings
Method Detail

getBindingURI

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

Returns:
SAML binding URI supported by this encoder

isPostEncoding

public boolean isPostEncoding()
Gets whether the encoder will encode the artifact via POST encoding.

Returns:
true if POST encoding will be used, false if GET encoding will be used

setPostEncoding

public void setPostEncoding(boolean post)
Sets whether the encoder will encode the artifact via POST encoding.

Parameters:
post - true if POST encoding will be used, false if GET encoding will be used

providesMessageConfidentiality

public boolean providesMessageConfidentiality(MessageContext messageContext)
                                       throws MessageEncodingException

Throws:
MessageEncodingException

providesMessageIntegrity

public boolean providesMessageIntegrity(MessageContext messageContext)
                                 throws MessageEncodingException

Throws:
MessageEncodingException

doEncode

protected void doEncode(MessageContext messageContext)
                 throws MessageEncodingException

Specified by:
doEncode in class BaseMessageEncoder
Throws:
MessageEncodingException

postEncode

protected void postEncode(SAMLMessageContext artifactContext,
                          HTTPOutTransport outTransport)
                   throws MessageEncodingException
Performs HTTP POST based encoding.

Parameters:
artifactContext - current request context
outTransport - outbound HTTP transport
Throws:
MessageEncodingException - thrown if there is a problem POST encoding the artifact

getEncode

protected void getEncode(SAMLMessageContext artifactContext,
                         HTTPOutTransport outTransport)
                  throws MessageEncodingException
Performs HTTP GET based encoding.

Parameters:
artifactContext - current request context
outTransport - outbound HTTP transport
Throws:
MessageEncodingException - thrown if there is a problem GET encoding the artifact

buildArtifact

protected AbstractSAML2Artifact buildArtifact(SAMLMessageContext artifactContext)
                                       throws MessageEncodingException
Builds the SAML 2 artifact for the outgoing message.

Parameters:
artifactContext - current request context
Returns:
SAML 2 artifact for outgoing message
Throws:
MessageEncodingException - thrown if the artifact can not be created


Copyright © 1999-2013. All Rights Reserved.