};
// Error template class
- class ShibMLPPriv;
class ShibMLP {
public:
- ShibMLP();
- ~ShibMLP();
+ ShibMLP() {}
+ ~ShibMLP() {}
- void insert (const std::string& key, const std::string& value);
+ void insert (const std::string& key, const std::string& value) {
+ m_map[key] = value;
+ }
void insert (const std::string& key, const char* value) {
- std::string v = value;
- insert (key, v);
+ m_map[key] = value;
}
void insert (const char* key, const std::string& value) {
- std::string k = key;
- insert (k, value);
+ m_map[key] = value;
}
void insert (const char* key, const char* value) {
- std::string k = key, v = value;
- insert(k,v);
+ m_map[key] = value;
}
void insert (saml::SAMLException& e);
- void clear () { m_map.clear(); }
+ void clear () {
+ m_map.clear();
+ }
const char* run (std::istream& s, const IPropertySet* props=NULL, std::string* output=NULL);
const char* run (const std::string& input, const IPropertySet* props=NULL, std::string* output=NULL);
}
private:
- ShibMLPPriv *m_priv;
+ static void html_encode(std::string& os, const char* start);
+
std::map<std::string,std::string> m_map;
std::string m_generated;
};
using namespace saml;
using namespace shibboleth;
using namespace shibtarget;
-using namespace shibtarget::logging;
-class shibtarget::ShibMLPPriv {
-public:
- ShibMLPPriv();
- ~ShibMLPPriv() {}
- Category *log;
-
- static void html_encode(string& os, const char* start);
-};
-
-
-void ShibMLPPriv::html_encode(string& os, const char* start)
+void ShibMLP::html_encode(string& os, const char* start)
{
while (start && *start) {
switch (*start) {
}
}
-ShibMLPPriv::ShibMLPPriv() : log(&(Category::getInstance("shibtarget.ShibMLP"))) {}
-
static void trimspace (string& s)
{
int end = s.size() - 1, start = 0;
s = s.substr(start, end - start + 1);
}
-ShibMLP::ShibMLP()
-{
- m_priv = new ShibMLPPriv ();
-}
-
-ShibMLP::~ShibMLP ()
-{
- delete m_priv;
-}
-
const char* ShibMLP::run(const string& is, const IPropertySet* props, std::string* output)
{
// Create a timestamp
const char* lastpos = line;
const char* thispos;
- m_priv->log->debug("Processing string");
-
//
// Search for SHIBMLP tags. These are of the form:
// <shibmlp key/>
map<string,string>::const_iterator i=m_map.find(key);
if (i != m_map.end()) {
- m_priv->html_encode(*output,i->second.c_str());
+ html_encode(*output,i->second.c_str());
}
else {
pair<bool,const char*> p=props ? props->getString(key.c_str()) : pair<bool,const char*>(false,NULL);
if (p.first) {
- m_priv->html_encode(*output,p.second);
+ html_encode(*output,p.second);
}
else {
static const char* s1 = "<!-- Unknown SHIBMLP key: ";
static string eol = "\r\n";
string str, line;
- m_priv->log->debug("processing stream");
-
while (getline(is, line))
str += line + eol;
insert("originContactEmail", email);
}
}
-
-void ShibMLP::insert (const std::string& key, const std::string& value)
-{
- m_priv->log->debug("inserting %s -> %s", key.c_str(), value.c_str());
- m_map[key] = value;
-}