Turn off chunking by default.
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Thu, 2 Aug 2007 20:45:55 +0000 (20:45 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Thu, 2 Aug 2007 20:45:55 +0000 (20:45 +0000)
Add transport option passthru, still need to hook up SOAP client.

git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@2379 cb58f699-b61c-0410-a6fe-9272a202ed29

configs/shibboleth2.xml.in
schemas/shibboleth-2.0-native-sp-config.xsd
shibsp/ServiceProvider.h
shibsp/impl/XMLServiceProvider.cpp

index 8a4a4f3..78ffb03 100644 (file)
                        signedAssertions="false"
                        requireConfidentiality="true"
                        requireTransportAuth="true"
-                       chunkedEncoding="true"
+                       chunkedEncoding="false"
                        connectTimeout="15" timeout="30"
                        >
                        <Rule type="SAML1Message"/>
index 05ffd7e..7c8f170 100644 (file)
                                        </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
                        </sequence>\r
                </complexType>\r
        </element>\r
+\r
+       <element name="TransportOption">\r
+               <annotation>\r
+                       <documentation>Implementation-specific option to pass to SOAPTransport provider.</documentation>\r
+               </annotation>\r
+               <complexType>\r
+                       <simpleContent>\r
+                               <extension base="anySimpleType">\r
+                                       <attribute name="provider" type="conf:string" use="required"/>\r
+                                       <attribute name="option" type="conf:string" use="required"/>\r
+                               </extension>\r
+                       </simpleContent>\r
+               </complexType>\r
+       </element>\r
        \r
 </schema>\r
index 2a322d6..ecb86fb 100644 (file)
@@ -26,6 +26,7 @@
 #include <shibsp/util/PropertySet.h>
 #ifndef SHIBSP_LITE
 # include <saml/binding/SecurityPolicyRule.h>
+# include <xmltooling/soap/SOAPTransport.h>
 # include <xmltooling/util/StorageService.h>
 #endif
 #include <xmltooling/Lockable.h>
@@ -115,6 +116,15 @@ namespace shibsp {
          * @return an array of policy rules
                 */
         virtual const std::vector<const opensaml::SecurityPolicyRule*>& getPolicyRules(const char* id) const=0;
+
+        /**
+         * Sets implementation-specific transport options for an identified policy.
+         *
+                * @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;
 #endif
 
         /**
index dce4b54..eb01515 100644 (file)
@@ -236,6 +236,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;
 #endif
         
         // Provides filter to exclude special config elements.
@@ -349,6 +350,22 @@ namespace {
                 return i->second.second;
             throw ConfigurationException("Security Policy ($1) not found, check <SecurityPolicies> element.", params(1,id));
         }
+
+        bool setTransportOptions(const char* id, 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) {
+                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;
+                }
+            }
+            return ret;
+        }
 #endif
 
     protected:
@@ -397,9 +414,11 @@ namespace {
     static const XMLCh MemoryListener[] =       UNICODE_LITERAL_14(M,e,m,o,r,y,L,i,s,t,e,n,e,r);
     static const XMLCh _MetadataProvider[] =    UNICODE_LITERAL_16(M,e,t,a,d,a,t,a,P,r,o,v,i,d,e,r);
     static const XMLCh Notify[] =               UNICODE_LITERAL_6(N,o,t,i,f,y);
+    static const XMLCh _option[] =              UNICODE_LITERAL_6(o,p,t,i,o,n);
     static const XMLCh OutOfProcess[] =         UNICODE_LITERAL_12(O,u,t,O,f,P,r,o,c,e,s,s);
     static const XMLCh _path[] =                UNICODE_LITERAL_4(p,a,t,h);
     static const XMLCh Policy[] =               UNICODE_LITERAL_6(P,o,l,i,c,y);
+    static const XMLCh _provider[] =            UNICODE_LITERAL_8(p,r,o,v,i,d,e,r);
     static const XMLCh RelyingParty[] =         UNICODE_LITERAL_12(R,e,l,y,i,n,g,P,a,r,t,y);
     static const XMLCh _ReplayCache[] =         UNICODE_LITERAL_11(R,e,p,l,a,y,C,a,c,h,e);
     static const XMLCh _RequestMapper[] =       UNICODE_LITERAL_13(R,e,q,u,e,s,t,M,a,p,p,e,r);
@@ -410,20 +429,20 @@ namespace {
     static const XMLCh _SingleLogoutService[] = UNICODE_LITERAL_19(S,i,n,g,l,e,L,o,g,o,u,t,S,e,r,v,i,c,e);
     static const XMLCh _StorageService[] =      UNICODE_LITERAL_14(S,t,o,r,a,g,e,S,e,r,v,i,c,e);
     static const XMLCh TCPListener[] =          UNICODE_LITERAL_11(T,C,P,L,i,s,t,e,n,e,r);
+    static const XMLCh TransportOption[] =      UNICODE_LITERAL_15(T,r,a,n,s,p,o,r,t,O,p,t,i,o,n);
     static const XMLCh _TrustEngine[] =         UNICODE_LITERAL_11(T,r,u,s,t,E,n,g,i,n,e);
     static const XMLCh _type[] =                UNICODE_LITERAL_4(t,y,p,e);
     static const XMLCh UnixListener[] =         UNICODE_LITERAL_12(U,n,i,x,L,i,s,t,e,n,e,r);
 
-
+#ifndef SHIBSP_LITE
     class SHIBSP_DLLLOCAL PolicyNodeFilter : public DOMNodeFilter
     {
     public:
         short acceptNode(const DOMNode* node) const {
-            if (XMLHelper::isNodeNamed(node,shibspconstants::SHIB2SPCONFIG_NS,Rule))
-                return FILTER_REJECT;
-            return FILTER_ACCEPT;
+            return FILTER_REJECT;
         }
     };
+#endif
 };
 
 namespace shibsp {
@@ -1380,6 +1399,8 @@ XMLConfigImpl::XMLConfigImpl(const DOMElement* e, bool first, const XMLConfig* o
                 auto_ptr<DOMPropertySet> settings(new DOMPropertySet());
                 settings->load(child, log, &filter);
                 rules.first = settings.release();
+                
+                // Process Rule elements.
                 const DOMElement* rule = XMLHelper::getFirstChildElement(child,Rule);
                 while (rule) {
                     auto_ptr_char type(rule->getAttributeNS(NULL,_type));
@@ -1391,6 +1412,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(provider.get(), make_pair(option.get(), value.get()))
+                                );
+                        }
+                    }
+                    rule = XMLHelper::getNextSiblingElement(rule,TransportOption);
+                }
+                
                 child = XMLHelper::getNextSiblingElement(child,Policy);
             }
         }