\r
#include <ctime>\r
#include <sstream>\r
-#include <log4cpp/Category.hh>\r
#include <xmltooling/XMLToolingConfig.h>\r
#include <xmltooling/util/DateTime.h>\r
#include <xmltooling/util/NDC.h>\r
\r
using namespace shibsp;\r
using namespace xmltooling;\r
-using namespace log4cpp;\r
using namespace std;\r
\r
namespace shibsp {\r
~RemotedSession() {\r
delete m_lock;\r
m_obj.destroy();\r
- for_each(m_attributes.begin(), m_attributes.end(), cleanup_pair<string,Attribute>());\r
+ for_each(m_attributes.begin(), m_attributes.end(), xmltooling::cleanup<Attribute>());\r
}\r
\r
Lockable* lock() {\r
const char* getAuthnContextDeclRef() const {\r
return m_obj["authncontext_decl"].string();\r
}\r
- const multimap<string,Attribute*>& getAttributes() const {\r
+ const vector<Attribute*>& getAttributes() const {\r
if (m_attributes.empty())\r
unmarshallAttributes();\r
return m_attributes;\r
}\r
+ const multimap<string,const Attribute*>& getIndexedAttributes() const {\r
+ if (m_attributeIndex.empty()) {\r
+ if (m_attributes.empty())\r
+ unmarshallAttributes();\r
+ for (vector<Attribute*>::const_iterator a = m_attributes.begin(); a != m_attributes.end(); ++a) {\r
+ const vector<string>& aliases = (*a)->getAliases();\r
+ for (vector<string>::const_iterator alias = aliases.begin(); alias != aliases.end(); ++alias)\r
+ m_attributeIndex.insert(make_pair(*alias, *a));\r
+ }\r
+ }\r
+ return m_attributeIndex;\r
+ }\r
const vector<const char*>& getAssertionIDs() const {\r
if (m_ids.empty()) {\r
DDF ids = m_obj["assertions"];\r
\r
int m_version;\r
mutable DDF m_obj;\r
- mutable multimap<string,Attribute*> m_attributes;\r
+ mutable vector<Attribute*> m_attributes;\r
+ mutable multimap<string,const Attribute*> m_attributeIndex;\r
mutable vector<const char*> m_ids;\r
time_t m_expires,m_lastAccess;\r
RemotedCache* m_cache;\r
while (!attr.isnull()) {\r
try {\r
attribute = Attribute::unmarshall(attr);\r
- m_attributes.insert(make_pair(attribute->getId(),attribute));\r
+ m_attributes.push_back(attribute);\r
if (m_cache->m_log.isDebugEnabled())\r
m_cache->m_log.debug("unmarshalled attribute (ID: %s) with %d value%s",\r
attribute->getId(), attr.first().integer(), attr.first().integer()!=1 ? "s" : "");\r
if (out.isstruct()) {\r
// We got an updated record back.\r
m_ids.clear();\r
- for_each(m_attributes.begin(), m_attributes.end(), cleanup_const_pair<string,Attribute>());\r
+ for_each(m_attributes.begin(), m_attributes.end(), xmltooling::cleanup<Attribute>());\r
m_attributes.clear();\r
+ m_attributeIndex.clear();\r
m_obj.destroy();\r
m_obj = out;\r
}\r
}\r
\r
RemotedCache::RemotedCache(const DOMElement* e)\r
- : SessionCache(e), m_log(Category::getInstance(SHIBSP_LOGCAT".SessionCache")), m_root(e), m_lock(NULL), shutdown(false)\r
+ : SessionCache(e, 900), m_log(Category::getInstance(SHIBSP_LOGCAT".SessionCache")), m_root(e), m_lock(NULL), shutdown(false)\r
{\r
if (!SPConfig::getConfig().getServiceProvider()->getListenerService())\r
throw ConfigurationException("RemotedCacheService requires a ListenerService, but none available.");\r