[cpp-sp COMMIT] in /branches/REL_2: schemas/shibboleth-2.0-native-sp-config.xsd shibsp/impl/XMLServiceProvider.cpp

noreply at shibboleth.net noreply at shibboleth.net
Mon Feb 27 03:42:04 GMT 2012


Author: scantor
Date: Mon Feb 27 03:42:03 2012
New Revision: 3583

URL: http://svn.shibboleth.net/view/cpp-sp?rev=3583&view=rev
Log:
Pluggable RelyingParty support.

Modified:
    branches/REL_2/schemas/shibboleth-2.0-native-sp-config.xsd
    branches/REL_2/shibsp/impl/XMLServiceProvider.cpp

Modified: branches/REL_2/schemas/shibboleth-2.0-native-sp-config.xsd
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/schemas/shibboleth-2.0-native-sp-config.xsd?rev=3583&r1=3582&r2=3583&view=diff
==============================================================================
--- branches/REL_2/schemas/shibboleth-2.0-native-sp-config.xsd (original)
+++ branches/REL_2/schemas/shibboleth-2.0-native-sp-config.xsd Mon Feb 27 03:42:03 2012
@@ -660,11 +660,14 @@
     <annotation>
       <documentation>Container for specifying settings to use with particular peers</documentation>
     </annotation>
-    <sequence/>
-    <attribute name="Name" type="conf:string" use="required"/>
+    <sequence>
+      <any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+    </sequence>
+    <attribute name="Name" type="conf:string"/>
+    <attribute name="type" type="conf:string"/>
     <attributeGroup ref="conf:RelyingPartyGroup"/>
     <attribute name="entityID" type="anyURI"/>
-    <anyAttribute namespace="##other" processContents="lax"/>
+    <anyAttribute namespace="##any" processContents="lax"/>
   </complexType>
 
   <complexType name="NotifyType">

Modified: branches/REL_2/shibsp/impl/XMLServiceProvider.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/impl/XMLServiceProvider.cpp?rev=3583&r1=3582&r2=3583&view=diff
==============================================================================
--- branches/REL_2/shibsp/impl/XMLServiceProvider.cpp (original)
+++ branches/REL_2/shibsp/impl/XMLServiceProvider.cpp Mon Feb 27 03:42:03 2012
@@ -78,6 +78,7 @@
 # include <saml/saml1/core/Assertions.h>
 # include <saml/saml2/core/Assertions.h>
 # include <saml/saml2/binding/SAML2ArtifactType0004.h>
+# include <saml/saml2/metadata/EntityMatcher.h>
 # include <saml/saml2/metadata/Metadata.h>
 # include <saml/saml2/metadata/MetadataProvider.h>
 # include <saml/util/SAMLConstants.h>
@@ -163,6 +164,7 @@
         }
         const PropertySet* getRelyingParty(const EntityDescriptor* provider) const;
         const PropertySet* getRelyingParty(const XMLCh* entityID) const;
+
         const vector<const XMLCh*>* getAudiences() const {
             return (m_audiences.empty() && m_base) ? m_base->getAudiences() : &m_audiences;
         }
@@ -237,7 +239,8 @@
         vector<const XMLCh*> m_audiences;
 
         // RelyingParty properties
-        map< xstring,boost::shared_ptr<PropertySet> > m_partyMap;
+        map< xstring,boost::shared_ptr<PropertySet> > m_partyMap;   // name-based matching
+        vector< pair< boost::shared_ptr<EntityMatcher>,boost::shared_ptr<PropertySet> > > m_partyVec;  // plugin-based matching
 #endif
         vector<string> m_remoteUsers,m_frontLogout,m_backLogout;
 
@@ -683,9 +686,17 @@
             rp->setParent(this);
             m_partyMap[child->getAttributeNS(nullptr, saml2::Attribute::NAME_ATTRIB_NAME)] = rp;
         }
+        else if (child->hasAttributeNS(nullptr, _type)) {
+            string emtype(XMLHelper::getAttrString(child, nullptr, _type));
+            boost::shared_ptr<EntityMatcher> em(SAMLConfig::getConfig().EntityMatcherManager.newPlugin(emtype, child));
+            boost::shared_ptr<DOMPropertySet> rp(new DOMPropertySet());
+            rp->load(child, nullptr, this);
+            rp->setParent(this);
+            m_partyVec.push_back(make_pair(em, rp));
+        }
         child = XMLHelper::getNextSiblingElement(child, RelyingParty);
     }
-    if (base && m_partyMap.empty() && !base->m_partyMap.empty()) {
+    if (base && m_partyMap.empty() && m_partyVec.empty() && (!base->m_partyMap.empty() || !base->m_partyVec.empty())) {
         // For inheritance of RPs to work, we have to pull them in to the override by cloning the DOM.
         child = XMLHelper::getFirstChildElement(base->getElement(), RelyingParty);
         while (child) {
@@ -695,6 +706,15 @@
                 rp->load(rpclone, nullptr, this);
                 rp->setParent(this);
                 m_partyMap[rpclone->getAttributeNS(nullptr, saml2::Attribute::NAME_ATTRIB_NAME)] = rp;
+            }
+            else if (child->hasAttributeNS(nullptr, _type)) {
+                DOMElement* rpclone = static_cast<DOMElement*>(child->cloneNode(true));
+                string emtype(XMLHelper::getAttrString(rpclone, nullptr, _type));
+                boost::shared_ptr<EntityMatcher> em(SAMLConfig::getConfig().EntityMatcherManager.newPlugin(emtype, rpclone));
+                boost::shared_ptr<DOMPropertySet> rp(new DOMPropertySet());
+                rp->load(rpclone, nullptr, this);
+                rp->setParent(this);
+                m_partyVec.push_back(make_pair(em, rp));
             }
             child = XMLHelper::getNextSiblingElement(child, RelyingParty);
         }
@@ -1447,9 +1467,19 @@

[... 20 lines stripped ...]


More information about the commits mailing list