org.opensaml.saml2.binding.encoding
Class HTTPRedirectDeflateEncoder

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.HTTPRedirectDeflateEncoder
All Implemented Interfaces:
HTTPMessageEncoder, MessageEncoder<javax.servlet.http.HttpServletResponse>

public class HTTPRedirectDeflateEncoder
extends AbstractSAML2HTTPMessageEncoder

SAML 2.0 HTTP Redirect encoder using the DEFLATE encoding method. This encoder only supports DEFLATE compression and DSA-SHA1 and RSA-SHA1 signatures.


Field Summary
static java.lang.String BINDING_URI
          URI for this binding.
static java.lang.String DSA_SHA1_SIGNATURE
          DSA with SHA1 signature algorithm.
static java.lang.String RSA_SHA1_SIGNATURE
          RSA with SHA1 signature algorithm.
 
Constructor Summary
HTTPRedirectDeflateEncoder()
           
 
Method Summary
protected  java.lang.String buildRedirectURL(java.lang.String message)
          Builds the URL to redirect the client to.
protected  byte[] defalteAndBase64Encode(SAMLObject message)
          DEFLATE (RFC1951) compresses the given SAML message.
 void encode()
          Encode the SAML message in the binding specific manner.
protected  java.lang.String generateSignature(java.lang.String algorithm, java.lang.String queryString)
          Generates the signature over the query string.
 java.lang.String getBindingURI()
          Gets the binding URI supported by this encoder.
protected  java.lang.String getSignatureAlgorithm()
          Gets the signature algorithm to use with the given signing credential.
protected  void removeSignature()
          Removes the signature from the protocol message.
 
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
 

Field Detail

BINDING_URI

public static final java.lang.String BINDING_URI
URI for this binding.

See Also:
Constant Field Values

DSA_SHA1_SIGNATURE

public static final java.lang.String DSA_SHA1_SIGNATURE
DSA with SHA1 signature algorithm.

See Also:
Constant Field Values

RSA_SHA1_SIGNATURE

public static final java.lang.String RSA_SHA1_SIGNATURE
RSA with SHA1 signature algorithm.

See Also:
Constant Field Values
Constructor Detail

HTTPRedirectDeflateEncoder

public HTTPRedirectDeflateEncoder()
Method Detail

getBindingURI

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

Returns:
binding URI supported by this encoder

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

removeSignature

protected void removeSignature()
Removes the signature from the protocol message.


defalteAndBase64Encode

protected byte[] defalteAndBase64Encode(SAMLObject message)
                                 throws BindingException
DEFLATE (RFC1951) compresses the given SAML message.

Parameters:
message - SAML message
Returns:
DEFLATE compressed message
Throws:
BindingException - thrown if there is a problem compressing the message

buildRedirectURL

protected java.lang.String buildRedirectURL(java.lang.String message)
                                     throws BindingException
Builds the URL to redirect the client to.

Parameters:
message - base64 encoded SAML message
Returns:
URL to redirect client to
Throws:
BindingException - thrown if the SAML message is neither a RequestAbstractType or Response

getSignatureAlgorithm

protected java.lang.String getSignatureAlgorithm()
                                          throws BindingException
Gets the signature algorithm to use with the given signing credential.

Returns:
signature algorithm to use with the given signing credential
Throws:
BindingException - thrown if the provided credential's private key is not an RSA or DSA key

generateSignature

protected java.lang.String generateSignature(java.lang.String algorithm,
                                             java.lang.String queryString)
                                      throws BindingException
Generates the signature over the query string.

Parameters:
algorithm - algorithm that should be used to sign the query string
queryString - query string to be signed
Returns:
base64 encoded signature of query string
Throws:
BindingException - there is an error computing the signature