#include "internal.h"
#include "exceptions.h"
#include "binding/HTTPRequest.h"
-#include "saml2/binding/SAML2POSTDecoder.h"
+#include "binding/MessageDecoder.h"
#include "saml2/core/Protocols.h"
#include "saml2/metadata/Metadata.h"
#include "saml2/metadata/MetadataProvider.h"
namespace opensaml {
namespace saml2p {
+ class SAML_DLLLOCAL SAML2POSTDecoder : public MessageDecoder
+ {
+ public:
+ SAML2POSTDecoder(const DOMElement* e) {}
+ virtual ~SAML2POSTDecoder() {}
+
+ xmltooling::XMLObject* decode(
+ std::string& relayState,
+ const GenericRequest& genericRequest,
+ SecurityPolicy& policy
+ ) const;
+ };
+
MessageDecoder* SAML_DLLLOCAL SAML2POSTDecoderFactory(const DOMElement* const & e)
{
return new SAML2POSTDecoder(e);
};
};
-SAML2POSTDecoder::SAML2POSTDecoder(const DOMElement* e) {}
-
XMLObject* SAML2POSTDecoder::decode(
std::string& relayState,
const GenericRequest& genericRequest,
XMLString::release(&decoded);
// Parse and bind the document into an XMLObject.
- DOMDocument* doc = (m_validate ? XMLToolingConfig::getConfig().getValidatingParser()
+ DOMDocument* doc = (policy.getValidating() ? XMLToolingConfig::getConfig().getValidatingParser()
: XMLToolingConfig::getConfig().getParser()).parse(is);
XercesJanitor<DOMDocument> janitor(doc);
auto_ptr<XMLObject> xmlObject(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(), true));
root = static_cast<saml2::RootObject*>(request);
}
- if (!m_validate)
+ if (!policy.getValidating())
SchemaValidators.validate(xmlObject.get());
+
+ // Run through the policy.
+ policy.evaluate(*root, &genericRequest);
// Check destination URL.
auto_ptr_char dest(request ? request->getDestination() : response->getDestination());
const char* dest2 = httpRequest->getRequestURL();
- if ((root->getSignature() || httpRequest->getParameter("Signature")) && !dest.get() || !*(dest.get())) {
+ if ((root->getSignature() || httpRequest->getParameter("Signature")) && (!dest.get() || !*(dest.get()))) {
log.error("signed SAML message missing Destination attribute");
throw BindingException("Signed SAML message missing Destination attribute identifying intended destination.");
}
throw BindingException("SAML message delivered with POST to incorrect server URL.");
}
- // Run through the policy.
- policy.evaluate(*root, &genericRequest);
return xmlObject.release();
}