org.opensaml.saml2.binding.decoding
Class BaseSAML2MessageDecoder

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

public abstract class BaseSAML2MessageDecoder
extends BaseSAMLMessageDecoder

Base class for SAML 2 message decoders.


Field Summary
private  org.slf4j.Logger log
          Class logger.
 
Constructor Summary
BaseSAML2MessageDecoder()
          Constructor.
BaseSAML2MessageDecoder(ParserPool pool)
          Constructor.
 
Method Summary
 void decode(MessageContext messageContext)
          
protected  String extractEntityId(Issuer issuer)
          Extracts the entity ID from the SAML 2 Issuer.
protected  void extractRequestInfo(SAMLMessageContext messageContext, RequestAbstractType request)
          Extract information from a SAML RequestAbstractType message.
protected  void extractResponseInfo(SAMLMessageContext messageContext, StatusResponseType statusResponse)
          Extract information from a SAML StatusResponse message.
protected  String getIntendedDestinationEndpointURI(SAMLMessageContext samlMsgCtx)
          Extract the message information which indicates to what receiver endpoint URI the SAML message was intended to be delivered.
protected  void populateMessageContext(SAMLMessageContext messageContext)
          Populates the message context with the message ID, issue instant, and issuer as well as the peer's entity descriptor if a metadata provider is present in the message context and the peer's role descriptor if its entity descriptor was retrieved and the message context has a populated peer role name.
protected  void populateMessageIdIssueInstantIssuer(SAMLMessageContext messageContext)
          Extracts the message ID, issue instant, and issuer from the incoming SAML message and populates the message context with it.
protected  void populateRelyingPartyMetadata(SAMLMessageContext messageContext)
          Populates the peer's entity metadata if a metadata provide is present in the message context.
 
Methods inherited from class org.opensaml.common.binding.decoding.BaseSAMLMessageDecoder
checkEndpointURI, compareEndpointURIs, getActualReceiverEndpointURI, getURIComparator, isIntendedDestinationEndpointURIRequired, isMessageSigned, setURIComparator
 
Methods inherited from class org.opensaml.ws.message.decoder.BaseMessageDecoder
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
 

Field Detail

log

private final org.slf4j.Logger log
Class logger.

Constructor Detail

BaseSAML2MessageDecoder

public BaseSAML2MessageDecoder()
Constructor.


BaseSAML2MessageDecoder

public BaseSAML2MessageDecoder(ParserPool pool)
Constructor.

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

decode

public void decode(MessageContext messageContext)
            throws MessageDecodingException,
                   SecurityException

Specified by:
decode in interface MessageDecoder
Overrides:
decode in class BaseMessageDecoder
Throws:
MessageDecodingException
SecurityException

populateMessageContext

protected void populateMessageContext(SAMLMessageContext messageContext)
                               throws MessageDecodingException
Populates the message context with the message ID, issue instant, and issuer as well as the peer's entity descriptor if a metadata provider is present in the message context and the peer's role descriptor if its entity descriptor was retrieved and the message context has a populated peer role name.

Parameters:
messageContext - message context to populate
Throws:
MessageDecodingException - thrown if there is a problem populating the message context

populateMessageIdIssueInstantIssuer

protected void populateMessageIdIssueInstantIssuer(SAMLMessageContext messageContext)
                                            throws MessageDecodingException
Extracts the message ID, issue instant, and issuer from the incoming SAML message and populates the message context with it.

Parameters:
messageContext - current message context
Throws:
MessageDecodingException - thrown if there is a problem populating the message context

extractResponseInfo

protected void extractResponseInfo(SAMLMessageContext messageContext,
                                   StatusResponseType statusResponse)
                            throws MessageDecodingException
Extract information from a SAML StatusResponse message.

Parameters:
messageContext - current message context
statusResponse - the SAML message to process
Throws:
MessageDecodingException - thrown if the response issuer has a format other than NameIDType.ENTITY or, if the response does not contain an issuer, if the contained assertions contain issuers that are not of NameIDType.ENTITY format or if the assertions contain different issuers

extractRequestInfo

protected void extractRequestInfo(SAMLMessageContext messageContext,
                                  RequestAbstractType request)
                           throws MessageDecodingException
Extract information from a SAML RequestAbstractType message.

Parameters:
messageContext - current message context
request - the SAML message to process
Throws:
MessageDecodingException - thrown if the request issuer has a format other than NameIDType.ENTITY

extractEntityId

protected String extractEntityId(Issuer issuer)
                          throws MessageDecodingException
Extracts the entity ID from the SAML 2 Issuer.

Parameters:
issuer - issuer to extract the entityID from
Returns:
entity ID of the issuer
Throws:
MessageDecodingException - thrown if the given issuer has a format other than NameIDType.ENTITY

populateRelyingPartyMetadata

protected void populateRelyingPartyMetadata(SAMLMessageContext messageContext)
                                     throws MessageDecodingException
Populates the peer's entity metadata if a metadata provide is present in the message context. Populates the peer's role descriptor if the entity metadata was available and the role name is present in the message context.

Parameters:
messageContext - current message context
Throws:
MessageDecodingException - thrown if there is a problem populating the message context

getIntendedDestinationEndpointURI

protected 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.

This SAML 2-specific implementation extracts the value of the protocol message Destination attribute.

Specified by:
getIntendedDestinationEndpointURI in class BaseSAMLMessageDecoder
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


Copyright © 1999-2013. All Rights Reserved.