Improve property inheritance, first batch of SessionInitiators, rename providerId.
[shibboleth/cpp-sp.git] / shibsp / impl / XMLServiceProvider.cpp
index e5c96a6..725970a 100644 (file)
@@ -75,14 +75,6 @@ namespace {
         XMLApplication(const ServiceProvider*, const DOMElement* e, const XMLApplication* base=NULL);\r
         ~XMLApplication() { cleanup(); }\r
     \r
-        // PropertySet\r
-        pair<bool,bool> getBool(const char* name, const char* ns=NULL) const;\r
-        pair<bool,const char*> getString(const char* name, const char* ns=NULL) const;\r
-        pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=NULL) const;\r
-        pair<bool,unsigned int> getUnsignedInt(const char* name, const char* ns=NULL) const;\r
-        pair<bool,int> getInt(const char* name, const char* ns=NULL) const;\r
-        const PropertySet* getPropertySet(const char* name, const char* ns="urn:mace:shibboleth:sp:config:2.0") const;\r
-\r
         // Application\r
         const ServiceProvider& getServiceProvider() const {return *m_sp;}\r
         const char* getId() const {return getString("id").second;}\r
@@ -214,6 +206,7 @@ namespace {
         }\r
 \r
         // PropertySet\r
+        void setParent(const PropertySet* parent) {return m_impl->setParent(parent);}\r
         pair<bool,bool> getBool(const char* name, const char* ns=NULL) const {return m_impl->getBool(name,ns);}\r
         pair<bool,const char*> getString(const char* name, const char* ns=NULL) const {return m_impl->getString(name,ns);}\r
         pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=NULL) const {return m_impl->getXMLString(name,ns);}\r
@@ -356,13 +349,15 @@ XMLApplication::XMLApplication(
     try {\r
         // First load any property sets.\r
         load(e,log,this);\r
+        if (base)\r
+            setParent(base);\r
 \r
         SPConfig& conf=SPConfig::getConfig();\r
         SAMLConfig& samlConf=SAMLConfig::getConfig();\r
         XMLToolingConfig& xmlConf=XMLToolingConfig::getConfig();\r
 \r
         m_hash=getId();\r
-        m_hash+=getString("providerId").second;\r
+        m_hash+=getString("entityID").second;\r
         m_hash=samlConf.hashSHA1(m_hash.c_str(), true);\r
 \r
         pair<bool,const char*> attributes = getString("attributeIds");\r
@@ -423,13 +418,13 @@ XMLApplication::XMLApplication(
                     }\r
                 }\r
                 else if (XMLString::equals(child->getLocalName(),SessionInitiator)) {\r
-                    auto_ptr_char bindprop(child->getAttributeNS(NULL,EndpointType::BINDING_ATTRIB_NAME));\r
-                    if (!bindprop.get() || !*(bindprop.get())) {\r
-                        log.warn("SessionInitiator element has no Binding attribute, skipping it...");\r
+                    auto_ptr_char type(child->getAttributeNS(NULL,_type));\r
+                    if (!type.get() || !*(type.get())) {\r
+                        log.warn("SessionInitiator element has no type attribute, skipping it...");\r
                         child = XMLHelper::getNextSiblingElement(child);\r
                         continue;\r
                     }\r
-                    handler=conf.SessionInitiatorManager.newPlugin(bindprop.get(),make_pair(child, getId()));\r
+                    handler=conf.SessionInitiatorManager.newPlugin(type.get(),make_pair(child, getId()));\r
                     pair<bool,const char*> si_id=handler->getString("id");\r
                     if (si_id.first && si_id.second)\r
                         m_sessionInitMap[si_id.second]=handler;\r
@@ -496,8 +491,8 @@ XMLApplication::XMLApplication(
             if (nlist->item(i)->getParentNode()->isSameNode(e) && nlist->item(i)->hasChildNodes())\r
                 m_audiences.push_back(nlist->item(i)->getFirstChild()->getNodeValue());\r
 \r
-        // Always include our own providerId as an audience.\r
-        m_audiences.push_back(getXMLString("providerId").second);\r
+        // Always include our own entityID as an audience.\r
+        m_audiences.push_back(getXMLString("entityID").second);\r
 \r
         if (conf.isEnabled(SPConfig::Metadata)) {\r
             child = XMLHelper::getFirstChildElement(e,_MetadataProvider);\r
@@ -627,54 +622,6 @@ short XMLApplication::acceptNode(const DOMNode* node) const
     return FILTER_ACCEPT;\r
 }\r
 \r
-pair<bool,bool> XMLApplication::getBool(const char* name, const char* ns) const\r
-{\r
-    pair<bool,bool> ret=DOMPropertySet::getBool(name,ns);\r
-    if (ret.first)\r
-        return ret;\r
-    return m_base ? m_base->getBool(name,ns) : ret;\r
-}\r
-\r
-pair<bool,const char*> XMLApplication::getString(const char* name, const char* ns) const\r
-{\r
-    pair<bool,const char*> ret=DOMPropertySet::getString(name,ns);\r
-    if (ret.first)\r
-        return ret;\r
-    return m_base ? m_base->getString(name,ns) : ret;\r
-}\r
-\r
-pair<bool,const XMLCh*> XMLApplication::getXMLString(const char* name, const char* ns) const\r
-{\r
-    pair<bool,const XMLCh*> ret=DOMPropertySet::getXMLString(name,ns);\r
-    if (ret.first)\r
-        return ret;\r
-    return m_base ? m_base->getXMLString(name,ns) : ret;\r
-}\r
-\r
-pair<bool,unsigned int> XMLApplication::getUnsignedInt(const char* name, const char* ns) const\r
-{\r
-    pair<bool,unsigned int> ret=DOMPropertySet::getUnsignedInt(name,ns);\r
-    if (ret.first)\r
-        return ret;\r
-    return m_base ? m_base->getUnsignedInt(name,ns) : ret;\r
-}\r
-\r
-pair<bool,int> XMLApplication::getInt(const char* name, const char* ns) const\r
-{\r
-    pair<bool,int> ret=DOMPropertySet::getInt(name,ns);\r
-    if (ret.first)\r
-        return ret;\r
-    return m_base ? m_base->getInt(name,ns) : ret;\r
-}\r
-\r
-const PropertySet* XMLApplication::getPropertySet(const char* name, const char* ns) const\r
-{\r
-    const PropertySet* ret=DOMPropertySet::getPropertySet(name,ns);\r
-    if (ret || !m_base)\r
-        return ret;\r
-    return m_base->getPropertySet(name,ns);\r
-}\r
-\r
 const PropertySet* XMLApplication::getRelyingParty(const EntityDescriptor* provider) const\r
 {\r
     if (!m_partyDefault && m_base)\r