#include <algorithm>
#include <boost/shared_ptr.hpp>
+#include <boost/algorithm/string/trim.hpp>
#include <boost/tuple/tuple.hpp>
#include <shibsp/exceptions.h>
#include <shibsp/SessionCache.h>
if (dest) {
// Modify in place.
dest->getValues()[i] = narrow.get();
+ trim(dest->getValues()[i]);
}
else {
// Add to new object.
destwrapper->getValues().push_back(narrow.get());
+ trim(destwrapper->getValues().back());
}
}
}
#include "attribute/ExtensibleAttribute.h"
#include "util/SPConstants.h"
+#include <boost/algorithm/string/trim.hpp>
+
using namespace shibsp;
using namespace xmltooling;
using namespace std;
string& processed = m_serialized.back();
string::size_type i=0,start=0;
- while (start!=string::npos && start<msg.length() && (i=msg.find("$",start))!=string::npos) {
+ while (start != string::npos && start < msg.length() && (i = msg.find("$",start)) != string::npos) {
if (i>start)
- processed += msg.substr(start,i-start); // append everything in between
- start=i+1; // move start to the beginning of the token name
- i=msg.find_first_not_of(legal,start); // find token delimiter
- if (i==start) { // append a non legal character
- processed+=msg[start++];
+ processed += msg.substr(start, i-start); // append everything in between
+ start = i+1; // move start to the beginning of the token name
+ i = msg.find_first_not_of(legal, start); // find token delimiter
+ if (i == start) { // append a non legal character
+ processed += msg[start++];
continue;
}
- string tag = msg.substr(start,(i==string::npos) ? i : i-start);
+ string tag = msg.substr(start, (i==string::npos) ? i : i-start);
if (tag == "_string" && val.string()) {
processed += val.string();
- start=i;
+ start = i;
}
else {
DDF child = val.getmember(tag.c_str());
processed += child.string();
else if (child.isstruct() && child["_string"].string())
processed += child["_string"].string();
- start=i;
+ start = i;
}
}
- if (start!=string::npos && start<msg.length())
+ if (start != string::npos && start < msg.length())
processed += msg.substr(start,i); // append rest of string
+ boost::trim(processed);
val = m_obj.first().next();
}
#include "attribute/NameIDAttribute.h"
#include "remoting/ListenerService.h"
+#include <boost/algorithm/string/trim.hpp>
#include <xmltooling/exceptions.h>
#include <xmltooling/security/SecurityHelper.h>
);
if (m_hashAlg.empty()) {
m_serialized.push_back(e.what());
+ boost::trim(m_serialized.back());
}
else {
+ string trimmed(e.what());
+ boost::trim(trimmed);
#ifndef SHIBSP_LITE
- m_serialized.push_back(SecurityHelper::doHash(m_hashAlg.c_str(), e.what(), strlen(e.what())));
+ m_serialized.push_back(SecurityHelper::doHash(m_hashAlg.c_str(), trimmed.c_str(), strlen(e.what())));
#else
try {
DDF out, in("hash");
DDFJanitor jin(in), jout(out);
in.addmember("alg").string(m_hashAlg.c_str());
- in.addmember("data").unsafe_string(e.what());
+ in.addmember("data").unsafe_string(trimmed.c_str());
out = SPConfig::getConfig().getServiceProvider()->getListenerService()->send(in);
if (out.isstring() && out.string())
m_serialized.push_back(out.string());