Copied over mapping and filtering schemas.
[shibboleth/sp.git] / shibsp / impl / StorageServiceSessionCache.cpp
index 17ddd2f..f15ee52 100644 (file)
@@ -102,7 +102,7 @@ namespace shibsp {
         const char* getAuthnContextDeclRef() const {\r
             return m_obj["authncontext_decl"].string();\r
         }\r
-        const map<string,const Attribute*>& getAttributes() const {\r
+        const multimap<string,Attribute*>& getAttributes() const {\r
             if (m_attributes.empty())\r
                 unmarshallAttributes();\r
             return m_attributes;\r
@@ -128,7 +128,7 @@ namespace shibsp {
 \r
         DDF m_obj;\r
         saml2::NameID* m_nameid;\r
-        mutable map<string,const Attribute*> m_attributes;\r
+        mutable multimap<string,Attribute*> m_attributes;\r
         mutable vector<const char*> m_ids;\r
         mutable map<string,Assertion*> m_tokens;\r
         SSCache* m_cache;\r
@@ -153,7 +153,7 @@ namespace shibsp {
             const char* authncontext_class=NULL,\r
             const char* authncontext_decl=NULL,\r
             const vector<const Assertion*>* tokens=NULL,\r
-            const vector<Attribute*>* attributes=NULL\r
+            const multimap<string,Attribute*>* attributes=NULL\r
             );\r
         Session* find(const char* key, const Application& application, const char* client_addr=NULL, time_t timeout=0);\r
         void remove(const char* key, const Application& application, const char* client_addr);\r
@@ -174,7 +174,7 @@ StoredSession::~StoredSession()
 {\r
     m_obj.destroy();\r
     delete m_nameid;\r
-    for_each(m_attributes.begin(), m_attributes.end(), cleanup_const_pair<string,Attribute>());\r
+    for_each(m_attributes.begin(), m_attributes.end(), cleanup_pair<string,Attribute>());\r
     for_each(m_tokens.begin(), m_tokens.end(), cleanup_pair<string,Assertion>());\r
 }\r
 \r
@@ -186,7 +186,7 @@ void StoredSession::unmarshallAttributes() const
     while (!attr.isnull()) {\r
         try {\r
             attribute = Attribute::unmarshall(attr);\r
-            m_attributes[attribute->getId()] = attribute;\r
+            m_attributes.insert(make_pair(attribute->getId(), 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
@@ -457,7 +457,7 @@ string SSCache::insert(
     const char* authncontext_class,\r
     const char* authncontext_decl,\r
     const vector<const Assertion*>* tokens,\r
-    const vector<Attribute*>* attributes\r
+    const multimap<string,Attribute*>* attributes\r
     )\r
 {\r
 #ifdef _DEBUG\r
@@ -517,8 +517,8 @@ string SSCache::insert(
     if (attributes) {\r
         DDF attr;\r
         DDF attrlist = obj.addmember("attributes").list();\r
-        for (vector<Attribute*>::const_iterator a=attributes->begin(); a!=attributes->end(); ++a) {\r
-            attr = (*a)->marshall();\r
+        for (multimap<string,Attribute*>::const_iterator a=attributes->begin(); a!=attributes->end(); ++a) {\r
+            attr = a->second->marshall();\r
             attrlist.add(attr);\r
         }\r
     }\r
@@ -570,10 +570,10 @@ string SSCache::insert(
             ") for (applicationId: " <<\r
                 application.getId() <<\r
             ") {";\r
-        for (vector<Attribute*>::const_iterator a=attributes->begin(); a!=attributes->end(); ++a)\r
-            xlog->log.infoStream() << "\t" << (*a)->getId() << " (" << (*a)->valueCount() << " values)";\r
+        for (multimap<string,Attribute*>::const_iterator a=attributes->begin(); a!=attributes->end(); ++a)\r
+            xlog->log.infoStream() << "\t" << a->second->getId() << " (" << a->second->valueCount() << " values)";\r
         xlog->log.info("}");\r
-        for_each(attributes->begin(), attributes->end(), xmltooling::cleanup<Attribute>());\r
+        for_each(attributes->begin(), attributes->end(), cleanup_pair<string,Attribute>());\r
     }\r
 \r
     return key.get();\r