X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml1%2Fbinding%2Fimpl%2FSAML1SOAPDecoder.cpp;h=971d700a20302011d88eed0c456db381f81fb05c;hb=96437360be3fa1f0c182bdd13b54e00110e45f11;hp=78888241a757c10f010818fce12863843fe5a783;hpb=11cd3b15c71ee22f2818d810a17c213123e8c248;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/saml1/binding/impl/SAML1SOAPDecoder.cpp b/saml/saml1/binding/impl/SAML1SOAPDecoder.cpp index 7888824..971d700 100644 --- a/saml/saml1/binding/impl/SAML1SOAPDecoder.cpp +++ b/saml/saml1/binding/impl/SAML1SOAPDecoder.cpp @@ -22,10 +22,10 @@ #include "internal.h" #include "exceptions.h" -#include "binding/MessageDecoder.h" +#include "saml1/binding/SAML1MessageDecoder.h" #include "saml1/core/Protocols.h" -#include +#include #include #include #include @@ -33,13 +33,13 @@ using namespace opensaml::saml1p; using namespace opensaml; using namespace soap11; +using namespace xmltooling::logging; using namespace xmltooling; -using namespace log4cpp; using namespace std; namespace opensaml { namespace saml1p { - class SAML_DLLLOCAL SAML1SOAPDecoder : public MessageDecoder + class SAML_DLLLOCAL SAML1SOAPDecoder : public SAML1MessageDecoder { public: SAML1SOAPDecoder() {} @@ -105,8 +105,24 @@ XMLObject* SAML1SOAPDecoder::decode( Request* request = dynamic_cast(body->getUnknownXMLObjects().front()); if (request) { // Run through the policy at two layers. - policy.evaluate(*env, &genericRequest); - policy.evaluate(*request, &genericRequest); + pair minor = request->getMinorVersion(); + extractMessageDetails( + *env, + genericRequest, + (minor.first && minor.second==0) ? samlconstants::SAML10_PROTOCOL_ENUM : samlconstants::SAML11_PROTOCOL_ENUM, + policy + ); + policy.evaluate(*env,&genericRequest); + + // Reset, extract, and run again. + policy.reset(true); + extractMessageDetails( + *request, + genericRequest, + (minor.first && minor.second==0) ? samlconstants::SAML10_PROTOCOL_ENUM : samlconstants::SAML11_PROTOCOL_ENUM, + policy + ); + policy.evaluate(*request,&genericRequest); xmlObject.release(); body->detach(); // frees Envelope request->detach(); // frees Body @@ -114,5 +130,5 @@ XMLObject* SAML1SOAPDecoder::decode( } } - throw BindingException("SOAP Envelope did not contain a SAML Request."); + throw BindingException("SOAP Envelope did not contain a SAML 1.x Request."); }