#include "util/TemplateParameters.h"
#include <fstream>
+#include <boost/lexical_cast.hpp>
#include <xmltooling/XMLToolingConfig.h>
#include <xmltooling/util/PathResolver.h>
#include <xmltooling/util/URLEncoder.h>
using namespace shibsp;
using namespace xmltooling;
+using namespace boost;
using namespace std;
LogoutHandler::LogoutHandler() : m_initiator(true)
const Application* app=aid ? SPConfig::getConfig().getServiceProvider()->getApplication(aid) : nullptr;
if (!app) {
// Something's horribly wrong.
- Category::getInstance(SHIBSP_LOGCAT".Logout").error("couldn't find application (%s) for logout", aid ? aid : "(missing)");
+ Category::getInstance(SHIBSP_LOGCAT ".Logout").error("couldn't find application (%s) for logout", aid ? aid : "(missing)");
throw ConfigurationException("Unable to locate application for logout, deleted?");
}
loc = loc + (strchr(loc.c_str(),'?') ? '&' : '?') + "action=logout";
// Now we create a second URL representing the return location back to us.
- ostringstream locstr;
const char* start = request.getRequestURL();
- const char* end = strchr(start,'?');
- string tempstr(start, end ? end-start : strlen(start));
+ const char* end = strchr(start, '?');
+ string locstr(start, end ? end - start : strlen(start));
// Add a signal that we're coming back from notification and the next index.
- locstr << tempstr << "?notifying=1&index=" << index;
+ locstr = locstr + "?notifying=1&index=" + lexical_cast<string>(index);
// Add return if set.
if (param)
- locstr << "&return=" << encoder->encode(param);
+ locstr = locstr + "&return=" + encoder->encode(param);
// We preserve anything we're instructed to directly.
if (params) {
for (map<string,string>::const_iterator p = params->begin(); p!=params->end(); ++p)
- locstr << '&' << p->first << '=' << encoder->encode(p->second.c_str());
+ locstr = locstr + '&' + p->first + '=' + encoder->encode(p->second.c_str());
}
else {
for (vector<string>::const_iterator q = m_preserve.begin(); q!=m_preserve.end(); ++q) {
param = request.getParameter(q->c_str());
if (param)
- locstr << '&' << *q << '=' << encoder->encode(param);
+ locstr = locstr + '&' + *q + '=' + encoder->encode(param);
}
}
// Add the notifier's return parameter to the destination location and redirect.
// This is NOT the same as the return parameter that might be embedded inside it ;-)
- loc = loc + "&return=" + encoder->encode(locstr.str().c_str());
- return make_pair(true,response.sendRedirect(loc.c_str()));
+ loc = loc + "&return=" + encoder->encode(locstr.c_str());
+ return make_pair(true, response.sendRedirect(loc.c_str()));
}
#ifndef SHIBSP_LITE
HTTPSOAPTransport* http = dynamic_cast<HTTPSOAPTransport*>(&transport);
if (http) {
http->useChunkedEncoding(false);
- http->setRequestHeader("User-Agent", PACKAGE_NAME);
http->setRequestHeader(PACKAGE_NAME, PACKAGE_VERSION);
}
}
) const
{
if (sessions.empty()) {
- Category::getInstance(SHIBSP_LOGCAT".Logout").error("no sessions supplied to back channel notification method");
+ Category::getInstance(SHIBSP_LOGCAT ".Logout").error("no sessions supplied to back channel notification method");
return false;
}
if (SPConfig::getConfig().isEnabled(SPConfig::OutOfProcess)) {
#ifndef SHIBSP_LITE
- auto_ptr<Envelope> env(EnvelopeBuilder::buildEnvelope());
+ scoped_ptr<Envelope> env(EnvelopeBuilder::buildEnvelope());
Body* body = BodyBuilder::buildBody();
env->setBody(body);
ElementProxy* msg = new AnyElementImpl(shibspconstants::SHIB2SPNOTIFY_NS, LogoutNotification);
body->getUnknownXMLObjects().push_back(msg);
msg->setAttribute(xmltooling::QName(nullptr, _type), local ? _local : _global);
- for (vector<string>::const_iterator s = sessions.begin(); s!=sessions.end(); ++s) {
+ for (vector<string>::const_iterator s = sessions.begin(); s != sessions.end(); ++s) {
auto_ptr_XMLCh temp(s->c_str());
ElementProxy* child = new AnyElementImpl(shibspconstants::SHIB2SPNOTIFY_NS, SessionID);
child->setTextContent(temp.get());
SOAPNotifier soaper;
while (!endpoint.empty()) {
try {
- soaper.send(*env.get(), SOAPTransport::Address(application.getId(), application.getId(), endpoint.c_str()));
+ soaper.send(*env, SOAPTransport::Address(application.getId(), application.getId(), endpoint.c_str()));
delete soaper.receive();
}
- catch (exception& ex) {
- Category::getInstance(SHIBSP_LOGCAT".Logout").error("error notifying application of logout event: %s", ex.what());
+ catch (std::exception& ex) {
+ Category::getInstance(SHIBSP_LOGCAT ".Logout").error("error notifying application of logout event: %s", ex.what());
result = false;
}
soaper.reset();
DDF temp = DDF(nullptr).string(i->c_str());
s.add(temp);
}
- out=application.getServiceProvider().getListenerService()->send(in);
+ out = application.getServiceProvider().getListenerService()->send(in);
return (out.integer() == 1);
}
return logout_event;
}
else {
- Category::getInstance(SHIBSP_LOGCAT".Logout").warn("unable to audit event, log event object was of an incorrect type");
+ Category::getInstance(SHIBSP_LOGCAT ".Logout").warn("unable to audit event, log event object was of an incorrect type");
}
}
- catch (exception& ex) {
- Category::getInstance(SHIBSP_LOGCAT".Logout").warn("exception auditing event: %s", ex.what());
+ catch (std::exception& ex) {
+ Category::getInstance(SHIBSP_LOGCAT ".Logout").warn("exception auditing event: %s", ex.what());
}
return nullptr;
}