[cpp-sp] branch master updated: SSPCPP-884 - Extract registrationAuthority in Metadata extractor

Scott Cantor cantor.2 at osu.edu
Thu Mar 12 12:52:05 EDT 2020


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository cpp-sp.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=4f87d7ac9a35ba25dc8a94adeee6b7afc583bf8f

The following commit(s) were added to refs/heads/master by this push:
       new  4f87d7a   SSPCPP-884 - Extract registrationAuthority in Metadata extractor
4f87d7a is described below

commit 4f87d7ac9a35ba25dc8a94adeee6b7afc583bf8f
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Mar 12 12:50:45 2020 -0400

    SSPCPP-884 - Extract registrationAuthority in Metadata extractor
    
    https://issues.shibboleth.net/jira/browse/SSPCPP-884
---
 .../resolver/impl/MetadataAttributeExtractor.cpp   | 27 ++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/shibsp/attribute/resolver/impl/MetadataAttributeExtractor.cpp b/shibsp/attribute/resolver/impl/MetadataAttributeExtractor.cpp
index 5f1b9d4..0c0fb4d 100644
--- a/shibsp/attribute/resolver/impl/MetadataAttributeExtractor.cpp
+++ b/shibsp/attribute/resolver/impl/MetadataAttributeExtractor.cpp
@@ -85,7 +85,8 @@ namespace shibsp {
             m_privacyURL,
             m_orgName,
             m_orgDisplayName,
-            m_orgURL;
+            m_orgURL,
+            m_registrationAuthority;
         typedef boost::tuple< string,xstring,boost::shared_ptr<AttributeDecoder> > contact_tuple_t;
         typedef boost::tuple< string,int,int,boost::shared_ptr<AttributeDecoder> > logo_tuple_t;
         vector<contact_tuple_t> m_contacts; // tuple is attributeID, contact type, decoder
@@ -118,7 +119,8 @@ MetadataExtractor::MetadataExtractor(const DOMElement* e, bool deprecationSuppor
         m_privacyURL(XMLHelper::getAttrString(e, nullptr, PrivacyStatementURL::LOCAL_NAME)),
         m_orgName(XMLHelper::getAttrString(e, nullptr, OrganizationName::LOCAL_NAME)),
         m_orgDisplayName(XMLHelper::getAttrString(e, nullptr, OrganizationDisplayName::LOCAL_NAME)),
-        m_orgURL(XMLHelper::getAttrString(e, nullptr, OrganizationURL::LOCAL_NAME))
+        m_orgURL(XMLHelper::getAttrString(e, nullptr, OrganizationURL::LOCAL_NAME)),
+        m_registrationAuthority(XMLHelper::getAttrString(e, nullptr, RegistrationInfo::REGAUTHORITY_ATTRIB_NAME))
 {
     const DOMElement* child = e ? XMLHelper::getFirstChildElement(e) : nullptr;
     while (child) {
@@ -163,6 +165,8 @@ void MetadataExtractor::getAttributeIds(vector<string>& attributes) const
         attributes.push_back(m_orgDisplayName);
     if (!m_orgURL.empty())
         attributes.push_back(m_orgURL);
+    if (!m_registrationAuthority.empty())
+        attributes.push_back(m_registrationAuthority);
     for (vector<contact_tuple_t>::const_iterator c = m_contacts.begin(); c != m_contacts.end(); ++c)
         attributes.push_back(c->get<0>());
     for (vector<logo_tuple_t>::const_iterator l = m_logos.begin(); l != m_logos.end(); ++l)
@@ -257,6 +261,25 @@ void MetadataExtractor::extractAttributes(
         m_contacts.begin(), m_contacts.end(),
         boost::bind(&MetadataExtractor::doContactPerson, this, request, roleToExtract, _1, boost::ref(attributes))
         );
+
+    if (!m_registrationAuthority.empty()) {
+        const Extensions* exts = dynamic_cast<EntityDescriptor*>(roleToExtract->getParent())->getExtensions();
+        if (exts) {
+            const RegistrationInfo* reginfo;
+            for (vector<XMLObject*>::const_iterator ext = exts->getUnknownXMLObjects().begin(); ext != exts->getUnknownXMLObjects().end(); ++ext) {
+                reginfo = dynamic_cast<const RegistrationInfo*>(*ext);
+                if (reginfo) {
+                    auto_ptr_char temp(reginfo->getRegistrationAuthority());
+                    if (temp.get()) {
+                        auto_ptr<SimpleAttribute> attr(new SimpleAttribute(vector<string>(1, m_registrationAuthority)));
+                        attr->getValues().push_back(temp.get());
+                        attributes.push_back(attr.get());
+                        attr.release();
+                    }
+                }
+            }
+        }
+    }
 }
 
 template <class T> void MetadataExtractor::doLangSensitive(

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list