org.opensaml.common.binding.decoding
Class BaseSAMLMessageDecoder

java.lang.Object
  extended by org.opensaml.ws.message.decoder.BaseMessageDecoder
      extended by org.opensaml.common.binding.decoding.BaseSAMLMessageDecoder
All Implemented Interfaces:
SAMLMessageDecoder, MessageDecoder
Direct Known Subclasses:
BaseSAML1MessageDecoder, BaseSAML2MessageDecoder

public abstract class BaseSAMLMessageDecoder
extends BaseMessageDecoder
implements SAMLMessageDecoder

Base class for all SAML message decoders.


Field Summary
private  org.slf4j.Logger log
          Class logger.
private  URIComparator uriComparator
          The URIComparator implementation to use.
 
Constructor Summary
BaseSAMLMessageDecoder()
          Constructor.
BaseSAMLMessageDecoder(ParserPool pool)
          Constructor.
 
Method Summary
protected  void checkEndpointURI(SAMLMessageContext messageContext)
          Check the validity of the SAML protocol message receiver endpoint against requirements indicated in the message.
protected  boolean compareEndpointURIs(String messageDestination, String receiverEndpoint)
          Compare the message endpoint URI's specified.
protected  String getActualReceiverEndpointURI(SAMLMessageContext messageContext)
          Extract the transport endpoint at which this message was received.
protected abstract  String getIntendedDestinationEndpointURI(SAMLMessageContext samlMsgCtx)
          Extract the message information which indicates to what receiver endpoint URI the SAML message was intended to be delivered.
 URIComparator getURIComparator()
          Get the URIComparator to use in compareEndpointURIs(String, String).
protected abstract  boolean isIntendedDestinationEndpointURIRequired(SAMLMessageContext samlMsgCtx)
          Determine whether the binding implemented by the decoder requires the presence within the message of information indicating the intended message destination endpoint URI.
protected  boolean isMessageSigned(SAMLMessageContext messageContext)
          Determine whether the SAML message represented by the message context is digitally signed.
 void setURIComparator(URIComparator comparator)
          Set the URIComparator to use in compareEndpointURIs(String, String).
 
Methods inherited from class org.opensaml.ws.message.decoder.BaseMessageDecoder
decode, doDecode, getParserPool, logDecodedMessage, processSecurityPolicy, setParserPool, unmarshallMessage
 
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.decoding.SAMLMessageDecoder
getBindingURI
 
Methods inherited from interface org.opensaml.ws.message.decoder.MessageDecoder
decode
 

Field Detail

log

private final org.slf4j.Logger log
Class logger.


uriComparator

private URIComparator uriComparator
The URIComparator implementation to use.

Constructor Detail

BaseSAMLMessageDecoder

public BaseSAMLMessageDecoder()
Constructor.


BaseSAMLMessageDecoder

public BaseSAMLMessageDecoder(ParserPool pool)
Constructor.

Parameters:
pool - parser pool used to deserialize messages
Method Detail

setURIComparator

public void setURIComparator(URIComparator comparator)
Set the URIComparator to use in compareEndpointURIs(String, String).

Parameters:
comparator - The uriComparator to set.

getURIComparator

public URIComparator getURIComparator()
Get the URIComparator to use in compareEndpointURIs(String, String).

Returns:
Returns the uriComparator.

isMessageSigned

protected boolean isMessageSigned(SAMLMessageContext messageContext)
Determine whether the SAML message represented by the message context is digitally signed.

The default behavior is to examine whether an XML signature is present on the SAML protocol message. Subclasses may augment or replace with binding-specific behavior.

Parameters:
messageContext - current message context
Returns:
true if the message is considered to be digitially signed, false otherwise

isIntendedDestinationEndpointURIRequired

protected abstract boolean isIntendedDestinationEndpointURIRequired(SAMLMessageContext samlMsgCtx)
Determine whether the binding implemented by the decoder requires the presence within the message of information indicating the intended message destination endpoint URI.

Parameters:
samlMsgCtx - current SAML message context
Returns:
true if the intended message destination endpoint is required, false if not

getIntendedDestinationEndpointURI

protected abstract String getIntendedDestinationEndpointURI(SAMLMessageContext samlMsgCtx)
                                                     throws MessageDecodingException
Extract the message information which indicates to what receiver endpoint URI the SAML message was intended to be delivered.

Parameters:
samlMsgCtx - the SAML message context being processed
Returns:
the value of the intended destination endpoint URI, or null if not present or empty
Throws:
MessageDecodingException - thrown if the message is not an instance of SAML message that could be processed by the decoder

getActualReceiverEndpointURI

protected String getActualReceiverEndpointURI(SAMLMessageContext messageContext)
                                       throws MessageDecodingException
Extract the transport endpoint at which this message was received.

This default implementation assumes an underlying message context InTransport type of HttpServletRequestAdapter and returns the string representation of the underlying request URL as constructed via HttpServletRequest.getRequestURL().

Subclasses should override if binding-specific behavior or support for other transport typs is required. In this case, see also compareEndpointURIs(String, String).

Parameters:
messageContext - current message context
Returns:
string representing the transport endpoint URI at which the current message was received
Throws:
MessageDecodingException - thrown if the endpoint can not be extracted from the message context and converted to a string representation

compareEndpointURIs

protected boolean compareEndpointURIs(String messageDestination,
                                      String receiverEndpoint)
                               throws MessageDecodingException
Compare the message endpoint URI's specified.

The comparison is performed using the configured instance of URIComparator. By default, the URL subtype of URI is supported, and the default comparator implementation used is BasicURLComparator. Other types of URI's may be supported by configuring a different implementation of URIComparator.

Subclasses should override if binding-specific behavior is required. In this case, see also getActualReceiverEndpointURI(SAMLMessageContext).

Parameters:
messageDestination - the intended message destination endpoint URI
receiverEndpoint - the endpoint URI at which the message was received
Returns:
true if the endpoints are equivalent, false otherwise
Throws:
MessageDecodingException - thrown if the endpoints specified are not equivalent

checkEndpointURI

protected void checkEndpointURI(SAMLMessageContext messageContext)
                         throws SecurityException,
                                MessageDecodingException
Check the validity of the SAML protocol message receiver endpoint against requirements indicated in the message.

Parameters:
messageContext - current message context
Throws:
SecurityException - thrown if the message Destination attribute is invalid with respect to the receiver's endpoint
MessageDecodingException - thrown if there is a problem decoding and processing the message Destination or receiver endpoint information


Copyright © 1999-2013. All Rights Reserved.