org.opensaml.common.binding.decoding.impl
Class AbstractMessageDecoder<RequestType extends javax.servlet.ServletRequest>

java.lang.Object
  extended by org.opensaml.common.binding.decoding.impl.AbstractMessageDecoder<RequestType>
Type Parameters:
RequestType - request type that will be decoded
All Implemented Interfaces:
MessageDecoder<RequestType>
Direct Known Subclasses:
AbstractHTTPMessageDecoder

public abstract class AbstractMessageDecoder<RequestType extends javax.servlet.ServletRequest>
extends java.lang.Object
implements MessageDecoder<RequestType>

Base class for message decoder handling much of the boilerplate code.


Constructor Summary
AbstractMessageDecoder()
           
 
Method Summary
protected  void evaluateSecurityPolicy(XMLObject decodedMessage)
          Evaluates the registered security policy, if there is one, against the provided request and message.
 MetadataProvider getMetadataProvider()
          Gets the metadata provider used to lookup information about the issuer.
 ParserPool getParserPool()
          Gets the pool of parsers to use to parse XML.
 RequestType getRequest()
          Gets the request to decode.
 SAMLObject getSAMLMessage()
          Gets the SAML message that was received and decoded.
 SAMLSecurityPolicy getSecurityPolicy()
          Gets the security policy to apply to the request and its payload.
 TrustEngine getTrustEngine()
          Gets the trust engine used to verify the credentials of a request.
 void setMetadataProvider(MetadataProvider newProvider)
          Sets the metadata provider used to lookup information about the issuer.
 void setParserPool(ParserPool pool)
          Sets the pool of parsers to use to parse XML.
 void setRequest(RequestType newRequest)
          Sets the request to decode.
protected  void setSAMLMessage(SAMLObject newMessage)
          Sets the decoded SAML message.
 void setSecurityPolicy(SAMLSecurityPolicy policy)
          Sets the security policy to apply to the request and its payload.
 void setTrustEngine(TrustEngine newEngine)
          Sets the the trust engine used to verify the credentials of a request.
protected  XMLObject unmarshallMessage(java.io.InputStream samlMessage)
          Parses the incoming message into a DOM and then unmarshalls it into a SAMLObject.
 
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.MessageDecoder
decode, getBindingURI
 

Constructor Detail

AbstractMessageDecoder

public AbstractMessageDecoder()
Method Detail

getParserPool

public ParserPool getParserPool()
Gets the pool of parsers to use to parse XML.

Returns:
pool of parsers to use to parse XML

setParserPool

public void setParserPool(ParserPool pool)
Sets the pool of parsers to use to parse XML.

Parameters:
pool - pool of parsers to use to parse XML

getMetadataProvider

public MetadataProvider getMetadataProvider()
Gets the metadata provider used to lookup information about the issuer.

Specified by:
getMetadataProvider in interface MessageDecoder<RequestType extends javax.servlet.ServletRequest>
Returns:
metadata provider used to lookup information about the issuer

getRequest

public RequestType getRequest()
Gets the request to decode.

Specified by:
getRequest in interface MessageDecoder<RequestType extends javax.servlet.ServletRequest>
Returns:
request to decode

getSAMLMessage

public SAMLObject getSAMLMessage()
Gets the SAML message that was received and decoded.

Specified by:
getSAMLMessage in interface MessageDecoder<RequestType extends javax.servlet.ServletRequest>
Returns:
SAML message

getSecurityPolicy

public SAMLSecurityPolicy getSecurityPolicy()
Gets the security policy to apply to the request and its payload.

Specified by:
getSecurityPolicy in interface MessageDecoder<RequestType extends javax.servlet.ServletRequest>
Returns:
security policy to apply to the request and its payload

getTrustEngine

public TrustEngine getTrustEngine()
Gets the trust engine used to verify the credentials of a request.

Specified by:
getTrustEngine in interface MessageDecoder<RequestType extends javax.servlet.ServletRequest>
Returns:
the trust engine used to verify the credentials of a request

setMetadataProvider

public void setMetadataProvider(MetadataProvider newProvider)
Sets the metadata provider used to lookup information about the issuer.

Specified by:
setMetadataProvider in interface MessageDecoder<RequestType extends javax.servlet.ServletRequest>
Parameters:
newProvider - metadata provider used to lookup information about the issuer

setRequest

public void setRequest(RequestType newRequest)
Sets the request to decode.

Specified by:
setRequest in interface MessageDecoder<RequestType extends javax.servlet.ServletRequest>
Parameters:
newRequest - request to decode

setSAMLMessage

protected void setSAMLMessage(SAMLObject newMessage)
Sets the decoded SAML message.

Parameters:
newMessage - decoded SAML message

setSecurityPolicy

public void setSecurityPolicy(SAMLSecurityPolicy policy)
Sets the security policy to apply to the request and its payload.

Specified by:
setSecurityPolicy in interface MessageDecoder<RequestType extends javax.servlet.ServletRequest>
Parameters:
policy - security policy to apply to the request and its payload

setTrustEngine

public void setTrustEngine(TrustEngine newEngine)
Sets the the trust engine used to verify the credentials of a request.

Specified by:
setTrustEngine in interface MessageDecoder<RequestType extends javax.servlet.ServletRequest>
Parameters:
newEngine - the trust engine used to verify the credentials of a request

unmarshallMessage

protected XMLObject unmarshallMessage(java.io.InputStream samlMessage)
                               throws BindingException
Parses the incoming message into a DOM and then unmarshalls it into a SAMLObject.

Parameters:
samlMessage - message to unmarshall
Returns:
SAMLObject representation of the message
Throws:
BindingException - thrown if the incoming XML can not be parsed and unmarshalled

evaluateSecurityPolicy

protected void evaluateSecurityPolicy(XMLObject decodedMessage)
                               throws SecurityPolicyException
Evaluates the registered security policy, if there is one, against the provided request and message. This method will also set the issuer and issuer role metadata if provided by the operating security rules.

Parameters:
decodedMessage - message to evaluate the policy against
Throws:
SecurityPolicyException - thrown if the given request/message do not meet the requirements of the security policy