#include "internal.h"
#include "exceptions.h"
#include "binding/ArtifactMap.h"
+#include "binding/HTTPResponse.h"
#include "binding/URLEncoder.h"
#include "saml2/binding/SAML2Artifact.h"
#include "saml2/binding/SAML2ArtifactEncoder.h"
SAML2ArtifactEncoder::~SAML2ArtifactEncoder() {}
long SAML2ArtifactEncoder::encode(
- HTTPResponse& httpResponse,
+ GenericResponse& genericResponse,
xmltooling::XMLObject* xmlObject,
const char* destination,
const char* recipientID,
xmltooling::NDC ndc("encode");
#endif
Category& log = Category::getInstance(SAML_LOGCAT".MessageEncoder.SAML2Artifact");
+
log.debug("validating input");
-
+ HTTPResponse* httpResponse=dynamic_cast<HTTPResponse*>(&genericResponse);
+ if (!httpResponse)
+ throw BindingException("Unable to cast response interface to HTTPResponse type.");
if (relayState && strlen(relayState)>80)
throw BindingException("RelayState cannot exceed 80 bytes in length.");
if (relayState)
loc = loc + "&RelayState=" + escaper->encode(relayState);
log.debug("message encoded, sending redirect to client");
- return httpResponse.sendRedirect(loc.c_str());
+ return httpResponse->sendRedirect(loc.c_str());
}
else {
// Push message into template and send result to client.
params["RelayState"] = relayState;
stringstream s;
engine->run(infile, s, params);
- return httpResponse.sendResponse(s);
+ httpResponse->setContentType("text/html");
+ return httpResponse->sendResponse(s, HTTPResponse::SAML_HTTP_STATUS_OK);
}
}