#include "internal.h"
#include "exceptions.h"
-#include "binding/HTTPRequest.h"
+#include "binding/MessageDecoder.h"
#include "saml1/core/Assertions.h"
-#include "saml1/binding/SAML1POSTDecoder.h"
+#include "saml1/core/Protocols.h"
#include "saml2/metadata/Metadata.h"
#include "saml2/metadata/MetadataProvider.h"
#include <log4cpp/Category.hh>
#include <xercesc/util/Base64.hpp>
+#include <xmltooling/io/HTTPRequest.h>
#include <xmltooling/util/NDC.h>
#include <xmltooling/validation/ValidatorSuite.h>
namespace opensaml {
namespace saml1p {
+ class SAML_DLLLOCAL SAML1POSTDecoder : public MessageDecoder
+ {
+ public:
+ SAML1POSTDecoder(const DOMElement* e) {}
+ virtual ~SAML1POSTDecoder() {}
+
+ xmltooling::XMLObject* decode(
+ std::string& relayState,
+ const GenericRequest& genericRequest,
+ SecurityPolicy& policy
+ ) const;
+ };
+
MessageDecoder* SAML_DLLLOCAL SAML1POSTDecoderFactory(const DOMElement* const & e)
{
return new SAML1POSTDecoder(e);
};
};
-SAML1POSTDecoder::SAML1POSTDecoder(const DOMElement* e) {}
-
XMLObject* SAML1POSTDecoder::decode(
string& relayState,
const GenericRequest& genericRequest,
log.debug("validating input");
const HTTPRequest* httpRequest=dynamic_cast<const HTTPRequest*>(&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.");
if (strcmp(httpRequest->getMethod(),"POST"))
- return NULL;
+ throw BindingException("Invalid HTTP method ($1).", params(1, httpRequest->getMethod()));
const char* samlResponse = httpRequest->getParameter("SAMLResponse");
const char* TARGET = httpRequest->getParameter("TARGET");
if (!samlResponse || !TARGET)
- return NULL;
+ throw BindingException("Request missing SAMLResponse or TARGET parameters.");
relayState = TARGET;
// Decode the base64 into SAML.