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(),"GET"))
- return NULL;
+ throw BindingException("Invalid HTTP method ($1).", params(1, httpRequest->getMethod()));
vector<const char*> SAMLart;
const char* TARGET = httpRequest->getParameter("TARGET");
if (httpRequest->getParameters("SAMLart", SAMLart)==0 || !TARGET)
- return NULL;
+ throw BindingException("Request missing SAMLart or TARGET parameters.");
relayState = TARGET;
if (!m_artifactResolver || !policy.getMetadataProvider() || !policy.getRole())
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.
string s = genericRequest.getContentType();
if (s.find("text/xml") == string::npos) {
log.warn("ignoring incorrect content type (%s)", s.c_str() ? s.c_str() : "none");
- return NULL;
+ throw BindingException("Invalid content type for SOAP message.");
}
const char* data = genericRequest.getRequestBody();
- if (!data) {
- log.warn("empty request body");
- return NULL;
- }
+ if (!data)
+ throw BindingException("SOAP message had an empty request body.");
istringstream is(data);
// Parse and bind the document into an XMLObject.
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.");
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;
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* msg = httpRequest->getParameter("SAMLResponse");
if (!msg)
msg = httpRequest->getParameter("SAMLRequest");
if (!msg)
- return NULL;
+ throw BindingException("Request missing SAMLRequest or SAMLResponse parameter.");
const char* state = httpRequest->getParameter("RelayState");
if (state)
relayState = state;
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(),"GET"))
- return NULL;
+ throw BindingException("Invalid HTTP method ($1).", params(1, httpRequest->getMethod()));
const char* msg = httpRequest->getParameter("SAMLResponse");
if (!msg)
msg = httpRequest->getParameter("SAMLRequest");
if (!msg)
- return NULL;
+ throw BindingException("Request missing SAMLRequest or SAMLResponse parameter.");
const char* state = httpRequest->getParameter("RelayState");
if (state)
relayState = state;
state = httpRequest->getParameter("SAMLEncoding");
if (state && strcmp(state,samlconstants::SAML20_BINDING_URL_ENCODING_DEFLATE)) {
log.warn("SAMLEncoding (%s) was not recognized", state);
- return NULL;
+ throw BindingException("Unsupported SAMLEncoding value.");
}
// Decode the compressed message into SAML. First we base64-decode it.
string s = genericRequest.getContentType();
if (s.find("text/xml") == string::npos) {
log.warn("ignoring incorrect content type (%s)", s.c_str() ? s.c_str() : "none");
- return NULL;
+ throw BindingException("Invalid content type for SOAP message.");
}
const char* data = genericRequest.getRequestBody();
- if (!data) {
- log.warn("empty request body");
- return NULL;
- }
+ if (!data)
+ throw BindingException("SOAP message had an empty request body.");
istringstream is(data);
// Parse and bind the document into an XMLObject.