Correct location of TransportOption feature, makes no sense inside policies.
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Fri, 14 Mar 2008 23:21:48 +0000 (23:21 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Fri, 14 Mar 2008 23:21:48 +0000 (23:21 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@2777 cb58f699-b61c-0410-a6fe-9272a202ed29

schemas/shibboleth-2.0-native-sp-config.xsd
shibsp/ServiceProvider.h
shibsp/binding/impl/SOAPClient.cpp
shibsp/impl/XMLServiceProvider.cpp

index c5e2e31..ec8bf41 100644 (file)
@@ -83,6 +83,7 @@
                 <element name="RequestMapper" type="conf:PluggableType" minOccurs="0"/>\r
                                <element ref="conf:ApplicationDefaults"/>\r
                                <element ref="conf:SecurityPolicies"/>\r
+                <element ref="conf:TransportOption" minOccurs="0" maxOccurs="unbounded"/>
                        </sequence>\r
                        <attribute name="logger" type="anyURI"/>\r
                        <attribute name="clockSkew" type="unsignedInt"/>\r
                                        </annotation>\r
                                        <complexType>\r
                                                <sequence>\r
-                                                       <element ref="conf:TransportOption" minOccurs="0" maxOccurs="unbounded"/>\r
                                                        <element name="Rule" type="conf:PluggableType" minOccurs="1" maxOccurs="unbounded"/>\r
                                                </sequence>\r
                                                <attribute name="id" type="conf:string" use="required"/>\r
index f7b2ba1..9ef1dae 100644 (file)
@@ -118,13 +118,12 @@ namespace shibsp {
         virtual const std::vector<const opensaml::SecurityPolicyRule*>& getPolicyRules(const char* id) const=0;
 
         /**
-         * Sets implementation-specific transport options for an identified policy.
+         * Sets implementation-specific transport options.
          *
-                * @param id        identifies the policy to return
          * @param transport a SOAPTransport object
          * @return  true iff all options were successfully set
          */
-        virtual bool setTransportOptions(const char* id, xmltooling::SOAPTransport& transport) const=0;
+        virtual bool setTransportOptions(xmltooling::SOAPTransport& transport) const=0;
 #endif
 
         /**
index 3cef3d4..656a2c8 100644 (file)
@@ -173,7 +173,7 @@ void SOAPClient::prepareTransport(SOAPTransport& transport)
     transport.setConnectTimeout(timeout.first ? timeout.second : 10);
     timeout = m_relyingParty->getUnsignedInt("timeout");
     transport.setTimeout(timeout.first ? timeout.second : 20);
-    m_app.getServiceProvider().setTransportOptions(m_app.getString("policyId").second, transport);
+    m_app.getServiceProvider().setTransportOptions(transport);
 
     HTTPSOAPTransport* http = dynamic_cast<HTTPSOAPTransport*>(&transport);
     if (http) {
index fc507b7..eeb3f38 100644 (file)
@@ -226,7 +226,7 @@ namespace {
         map<string,Application*> m_appmap;
 #ifndef SHIBSP_LITE
         map< string,pair< PropertySet*,vector<const SecurityPolicyRule*> > > m_policyMap;
-        map< string, vector< pair< string, pair<string,string> > > > m_transportOptionMap;
+        vector< pair< string, pair<string,string> > > m_transportOptions;
 #endif
         
         // Provides filter to exclude special config elements.
@@ -345,14 +345,10 @@ namespace {
             throw ConfigurationException("Security Policy ($1) not found, check <SecurityPolicies> element.", params(1,id));
         }
 
-        bool setTransportOptions(const char* id, SOAPTransport& transport) const {
+        bool setTransportOptions(SOAPTransport& transport) const {
             bool ret = true;
-            map< string, vector< pair< string, pair<string,string> > > >::const_iterator p =
-                m_impl->m_transportOptionMap.find(id);
-            if (p == m_impl->m_transportOptionMap.end())
-                return ret;
             vector< pair< string, pair<string,string> > >::const_iterator opt;
-            for (opt = p->second.begin(); opt != p->second.end(); ++opt) {
+            for (opt = m_impl->m_transportOptions.begin(); opt != m_impl->m_transportOptions.end(); ++opt) {
                 if (!transport.setProviderOption(opt->first.c_str(), opt->second.first.c_str(), opt->second.second.c_str())) {
                     m_log.error("failed to set SOAPTransport option (%s)", opt->second.first.c_str());
                     ret = false;
@@ -1130,6 +1126,7 @@ short XMLConfigImpl::acceptNode(const DOMNode* node) const
         XMLString::equals(name,Site) ||
         XMLString::equals(name,_StorageService) ||
         XMLString::equals(name,TCPListener) ||
+        XMLString::equals(name,TransportOption) ||
         XMLString::equals(name,UnixListener))
         return FILTER_REJECT;
 
@@ -1363,25 +1360,23 @@ XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* o
                     rule = XMLHelper::getNextSiblingElement(rule,Rule);
                 }
                 
-                // Process TransportOption elements.
-                rule = XMLHelper::getFirstChildElement(child,TransportOption);
-                while (rule) {
-                    if (rule->hasChildNodes()) {
-                        auto_ptr_char provider(rule->getAttributeNS(NULL,_provider));
-                        auto_ptr_char option(rule->getAttributeNS(NULL,_option));
-                        auto_ptr_char value(rule->getFirstChild()->getNodeValue());
-                        if (provider.get() && *provider.get() && option.get() && *option.get() && value.get() && *value.get()) {
-                            m_transportOptionMap[id.get()].push_back(
-                                make_pair(string(provider.get()), make_pair(string(option.get()), string(value.get())))
-                                );
-                        }
-                    }
-                    rule = XMLHelper::getNextSiblingElement(rule,TransportOption);
-                }
-                
                 child = XMLHelper::getNextSiblingElement(child,Policy);
             }
         }
+
+        // Process TransportOption elements.
+        child = XMLHelper::getLastChildElement(e,TransportOption);
+        while (child) {
+            if (child->hasChildNodes()) {
+                auto_ptr_char provider(child->getAttributeNS(NULL,_provider));
+                auto_ptr_char option(child->getAttributeNS(NULL,_option));
+                auto_ptr_char value(child->getFirstChild()->getNodeValue());
+                if (provider.get() && *provider.get() && option.get() && *option.get() && value.get() && *value.get()) {
+                    m_transportOptions.push_back(make_pair(string(provider.get()), make_pair(string(option.get()), string(value.get()))));
+                }
+            }
+            child = XMLHelper::getPreviousSiblingElement(child,TransportOption);
+        }
 #endif
 
         // Load the default application. This actually has a fixed ID of "default". ;-)