Add back alias support for attributes.
[shibboleth/sp.git] / shibsp / attribute / StringAttributeDecoder.cpp
index b652ee0..0e075dd 100644 (file)
@@ -41,7 +41,7 @@ namespace shibsp {
         ~StringAttributeDecoder() {}\r
 \r
         shibsp::Attribute* decode(\r
-            const char* id, const XMLObject* xmlObject, const char* assertingParty=NULL, const char* relyingParty=NULL\r
+            const vector<string>& ids, const XMLObject* xmlObject, const char* assertingParty=NULL, const char* relyingParty=NULL\r
             ) const;\r
     };\r
 \r
@@ -52,11 +52,11 @@ namespace shibsp {
 };\r
 \r
 shibsp::Attribute* StringAttributeDecoder::decode(\r
-    const char* id, const XMLObject* xmlObject, const char* assertingParty, const char* relyingParty\r
+    const vector<string>& ids, const XMLObject* xmlObject, const char* assertingParty, const char* relyingParty\r
     ) const\r
 {\r
     char* val;\r
-    auto_ptr<SimpleAttribute> simple(new SimpleAttribute(id));\r
+    auto_ptr<SimpleAttribute> simple(new SimpleAttribute(ids));\r
     simple->setCaseSensitive(m_caseSensitive);\r
     vector<string>& dest = simple->getValues();\r
     vector<XMLObject*>::const_iterator v,stop;\r
@@ -71,7 +71,10 @@ shibsp::Attribute* StringAttributeDecoder::decode(
             stop = values.end();\r
             if (log.isDebugEnabled()) {\r
                 auto_ptr_char n(saml2attr->getName());\r
-                log.debug("decoding SimpleAttribute (%s) from SAML 2 Attribute (%s) with %lu value(s)", id, n.get() ? n.get() : "unnamed", values.size());\r
+                log.debug(\r
+                    "decoding SimpleAttribute (%s) from SAML 2 Attribute (%s) with %lu value(s)",\r
+                    ids.front().c_str(), n.get() ? n.get() : "unnamed", values.size()\r
+                    );\r
             }\r
         }\r
         else {\r
@@ -82,7 +85,10 @@ shibsp::Attribute* StringAttributeDecoder::decode(
                 stop = values.end();\r
                 if (log.isDebugEnabled()) {\r
                     auto_ptr_char n(saml1attr->getAttributeName());\r
-                    log.debug("decoding SimpleAttribute (%s) from SAML 1 Attribute (%s) with %lu value(s)", id, n.get() ? n.get() : "unnamed", values.size());\r
+                log.debug(\r
+                    "decoding SimpleAttribute (%s) from SAML 1 Attribute (%s) with %lu value(s)",\r
+                    ids.front().c_str(), n.get() ? n.get() : "unnamed", values.size()\r
+                    );\r
                 }\r
             }\r
             else {\r
@@ -112,7 +118,7 @@ shibsp::Attribute* StringAttributeDecoder::decode(
     if (saml2name) {\r
         if (log.isDebugEnabled()) {\r
             auto_ptr_char f(saml2name->getFormat());\r
-            log.debug("decoding SimpleAttribute (%s) from SAML 2 NameID with Format (%s)", id, f.get() ? f.get() : "unspecified");\r
+            log.debug("decoding SimpleAttribute (%s) from SAML 2 NameID with Format (%s)", ids.front().c_str(), f.get() ? f.get() : "unspecified");\r
         }\r
         val = toUTF8(saml2name->getName());\r
     }\r
@@ -121,7 +127,10 @@ shibsp::Attribute* StringAttributeDecoder::decode(
         if (saml1name) {\r
             if (log.isDebugEnabled()) {\r
                 auto_ptr_char f(saml1name->getFormat());\r
-                log.debug("decoding SimpleAttribute (%s) from SAML 1 NameIdentifier with Format (%s)", id, f.get() ? f.get() : "unspecified");\r
+                log.debug(\r
+                    "decoding SimpleAttribute (%s) from SAML 1 NameIdentifier with Format (%s)",\r
+                    ids.front().c_str(), f.get() ? f.get() : "unspecified"\r
+                    );\r
             }\r
             val = toUTF8(saml1name->getName());\r
         }\r