X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml2%2Fbinding%2Fimpl%2FSAML2ArtifactDecoder.cpp;h=17a22ecc76e56176e36cc323b96c77e241b3ff0b;hb=98b9be4dacac1d9a8729906473e35fc904676d12;hp=42882cb5faeddf6b439b2b30cc99f3fc638967f5;hpb=2cf60ce131535beae932489d2d1e3d2355799061;p=shibboleth%2Fopensaml2.git diff --git a/saml/saml2/binding/impl/SAML2ArtifactDecoder.cpp b/saml/saml2/binding/impl/SAML2ArtifactDecoder.cpp index 42882cb..17a22ec 100644 --- a/saml/saml2/binding/impl/SAML2ArtifactDecoder.cpp +++ b/saml/saml2/binding/impl/SAML2ArtifactDecoder.cpp @@ -22,15 +22,14 @@ #include "internal.h" #include "exceptions.h" -#include "binding/HTTPRequest.h" -#include "saml/binding/SAMLArtifact.h" +#include "binding/MessageDecoder.h" #include "saml2/binding/SAML2Artifact.h" -#include "saml2/binding/SAML2ArtifactDecoder.h" #include "saml2/core/Protocols.h" #include "saml2/metadata/Metadata.h" #include "saml2/metadata/MetadataProvider.h" #include +#include #include #include @@ -44,6 +43,19 @@ using namespace std; namespace opensaml { namespace saml2p { + class SAML_DLLLOCAL SAML2ArtifactDecoder : public MessageDecoder + { + public: + SAML2ArtifactDecoder(const DOMElement* e) {} + virtual ~SAML2ArtifactDecoder() {} + + xmltooling::XMLObject* decode( + std::string& relayState, + const GenericRequest& genericRequest, + SecurityPolicy& policy + ) const; + }; + MessageDecoder* SAML_DLLLOCAL SAML2ArtifactDecoderFactory(const DOMElement* const & e) { return new SAML2ArtifactDecoder(e); @@ -51,8 +63,6 @@ namespace opensaml { }; }; -SAML2ArtifactDecoder::SAML2ArtifactDecoder(const DOMElement* e) {} - XMLObject* SAML2ArtifactDecoder::decode( string& relayState, const GenericRequest& genericRequest, @@ -66,13 +76,11 @@ XMLObject* SAML2ArtifactDecoder::decode( log.debug("validating input"); const HTTPRequest* httpRequest=dynamic_cast(&genericRequest); - if (!httpRequest) { - log.error("unable to cast request to HTTPRequest type"); - return NULL; - } + if (!httpRequest) + throw BindingException("Unable to cast request object to HTTPRequest type."); const char* SAMLart = httpRequest->getParameter("SAMLart"); if (!SAMLart) - return NULL; + throw BindingException("Request missing SAMLart parameter."); const char* state = httpRequest->getParameter("RelayState"); if (state) relayState = state; @@ -139,6 +147,7 @@ XMLObject* SAML2ArtifactDecoder::decode( } policy.setIssuerMetadata(roledesc); + log.debug("calling ArtifactResolver..."); auto_ptr response( m_artifactResolver->resolve(*(artifact2.get()), dynamic_cast(*roledesc), policy) );