org.opensaml.saml2.binding.encoding
Class HTTPRedirectDeflateEncoder

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.HTTPRedirectDeflateEncoder
All Implemented Interfaces:
SAMLMessageEncoder, MessageEncoder

public class HTTPRedirectDeflateEncoder
extends BaseSAML2MessageEncoder

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
private  org.slf4j.Logger log
          Class logger.
 
Constructor Summary
HTTPRedirectDeflateEncoder()
          Constructor.
 
Method Summary
protected  String buildRedirectURL(SAMLMessageContext messagesContext, String endpointURL, String message)
          Builds the URL to redirect the client to.
protected  String deflateAndBase64Encode(SAMLObject message)
          DEFLATE (RFC1951) compresses the given SAML message.
protected  void doEncode(MessageContext messageContext)
          
protected  String generateSignature(Credential signingCredential, String algorithmURI, String queryString)
          Generates the signature over the query string.
 String getBindingURI()
          Gets the SAML binding URI supported by this encoder.
protected  String getSignatureAlgorithmURI(Credential credential, SecurityConfiguration config)
          Gets the signature algorithm URI to use with the given signing credential.
 boolean providesMessageConfidentiality(MessageContext messageContext)
          
 boolean providesMessageIntegrity(MessageContext messageContext)
          
protected  void removeSignature(SAMLMessageContext messageContext)
          Removes the signature from the protocol message.
 
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.

Constructor Detail

HTTPRedirectDeflateEncoder

public HTTPRedirectDeflateEncoder()
Constructor.

Method Detail

getBindingURI

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

Returns:
SAML binding URI supported by this encoder

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

removeSignature

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

Parameters:
messageContext - current message context

deflateAndBase64Encode

protected String deflateAndBase64Encode(SAMLObject message)
                                 throws MessageEncodingException
DEFLATE (RFC1951) compresses the given SAML message.

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

buildRedirectURL

protected String buildRedirectURL(SAMLMessageContext messagesContext,
                                  String endpointURL,
                                  String message)
                           throws MessageEncodingException
Builds the URL to redirect the client to.

Parameters:
messagesContext - current message context
endpointURL - endpoint URL to send encoded message to
message - Deflated and Base64 encoded message
Returns:
URL to redirect client to
Throws:
MessageEncodingException - thrown if the SAML message is neither a RequestAbstractType or Response

getSignatureAlgorithmURI

protected String getSignatureAlgorithmURI(Credential credential,
                                          SecurityConfiguration config)
                                   throws MessageEncodingException
Gets the signature algorithm URI to use with the given signing credential.

Parameters:
credential - the credential that will be used to sign the message
config - the SecurityConfiguration to use (may be null)
Returns:
signature algorithm to use with the given signing credential
Throws:
MessageEncodingException - thrown if the algorithm URI could not be derived from the supplied credential

generateSignature

protected String generateSignature(Credential signingCredential,
                                   String algorithmURI,
                                   String queryString)
                            throws MessageEncodingException
Generates the signature over the query string.

Parameters:
signingCredential - credential that will be used to sign query string
algorithmURI - algorithm URI of the signing credential
queryString - query string to be signed
Returns:
base64 encoded signature of query string
Throws:
MessageEncodingException - there is an error computing the signature


Copyright © 1999-2012. All Rights Reserved.