X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml2%2Fbinding%2Fimpl%2FSAML2POSTDecoder.cpp;h=1898c4b46f7bab285ae1892c8a41edfc7106a171;hb=d6646ff459c51113410f261f9b8e1e02127e7210;hp=cdb806035c426d8a6fa91fdaa620f469441c8b77;hpb=9fddf9054c76de6239295b98a559fcc75453effc;p=shibboleth%2Fopensaml2.git diff --git a/saml/saml2/binding/impl/SAML2POSTDecoder.cpp b/saml/saml2/binding/impl/SAML2POSTDecoder.cpp index cdb8060..1898c4b 100644 --- a/saml/saml2/binding/impl/SAML2POSTDecoder.cpp +++ b/saml/saml2/binding/impl/SAML2POSTDecoder.cpp @@ -22,7 +22,7 @@ #include "internal.h" #include "exceptions.h" -#include "binding/MessageDecoder.h" +#include "saml2/binding/SAML2MessageDecoder.h" #include "saml2/core/Protocols.h" #include "saml2/metadata/Metadata.h" #include "saml2/metadata/MetadataProvider.h" @@ -43,7 +43,7 @@ using namespace std; namespace opensaml { namespace saml2p { - class SAML_DLLLOCAL SAML2POSTDecoder : public MessageDecoder + class SAML_DLLLOCAL SAML2POSTDecoder : public SAML2MessageDecoder { public: SAML2POSTDecoder() {} @@ -84,7 +84,7 @@ XMLObject* SAML2POSTDecoder::decode( if (!msg) msg = httpRequest->getParameter("SAMLRequest"); if (!msg) - throw BindingException("Request missing SAMLRequest or SAMLResponse parameter."); + throw BindingException("Request missing SAMLRequest or SAMLResponse form parameter."); const char* state = httpRequest->getParameter("RelayState"); if (state) relayState = state; @@ -121,9 +121,10 @@ XMLObject* SAML2POSTDecoder::decode( } if (!policy.getValidating()) - SchemaValidators.validate(xmlObject.get()); + SchemaValidators.validate(root); // Run through the policy. + extractMessageDetails(*root, genericRequest, samlconstants::SAML20P_NS, policy); policy.evaluate(*root, &genericRequest); // Check destination URL. @@ -134,7 +135,7 @@ XMLObject* SAML2POSTDecoder::decode( log.error("signed SAML message missing Destination attribute"); throw BindingException("Signed SAML message missing Destination attribute identifying intended destination."); } - else if ((delim && strncmp(dest.get(), dest2, delim - dest2)) || (!delim && strcmp(dest.get(),dest2))) { + else if (dest.get() && *dest.get() && ((delim && strncmp(dest.get(), dest2, delim - dest2)) || (!delim && strcmp(dest.get(),dest2)))) { log.error("POST targeted at (%s), but delivered to (%s)", dest.get(), dest2); throw BindingException("SAML message delivered with POST to incorrect server URL."); }