[shibboleth-sp2] 03/29: https://issues.shibboleth.net/jira/browse/SSPCPP-371

Ferenc Wágner wferi-guest at moszumanska.debian.org
Tue Jan 26 21:30:25 UTC 2016


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

wferi-guest pushed a commit to annotated tag 2.4.3
in repository shibboleth-sp2.

commit 26e1a930bce308913eacec0b6ec1eb7a3d81c17c
Author: Scott Cantor <cantor.2 at osu.edu>
Date:   Mon Jun 6 00:21:50 2011 +0000

    https://issues.shibboleth.net/jira/browse/SSPCPP-371
---
 shibsp/handler/impl/SAML2LogoutInitiator.cpp  | 46 +++++++++------
 shibsp/handler/impl/SAML2SessionInitiator.cpp | 83 ++++++++++++++++-----------
 2 files changed, 75 insertions(+), 54 deletions(-)

diff --git a/shibsp/handler/impl/SAML2LogoutInitiator.cpp b/shibsp/handler/impl/SAML2LogoutInitiator.cpp
index 5d0f14a..6c798fc 100644
--- a/shibsp/handler/impl/SAML2LogoutInitiator.cpp
+++ b/shibsp/handler/impl/SAML2LogoutInitiator.cpp
@@ -71,6 +71,8 @@ namespace shibsp {
 #endif
         }
 
+        void init(const char* location);    // encapsulates actions that need to run either in the c'tor or setParent
+
         void setParent(const PropertySet* parent);
         void receive(DDF& in, ostream& out);
         pair<bool,long> run(SPRequest& request, bool isHandler=true) const;
@@ -114,6 +116,30 @@ SAML2LogoutInitiator::SAML2LogoutInitiator(const DOMElement* e, const char* appI
 #endif
         m_protocol(samlconstants::SAML20P_NS)
 {
+    // If Location isn't set, defer initialization until the setParent call.
+    pair<bool,const char*> loc = getString("Location");
+    if (loc.first) {
+        init(loc.second);
+    }
+}
+
+void SAML2LogoutInitiator::setParent(const PropertySet* parent)
+{
+    DOMPropertySet::setParent(parent);
+    pair<bool,const char*> loc = getString("Location");
+    init(loc.second);
+}
+
+void SAML2LogoutInitiator::init(const char* location)
+{
+    if (location) {
+        string address = m_appId + location + "::run::SAML2LI";
+        setAddress(address.c_str());
+    }
+    else {
+        m_log.warn("no Location property in SAML2 LogoutInitiator (or parent), can't register as remoted handler");
+    }
+
 #ifndef SHIBSP_LITE
     if (SPConfig::getConfig().isEnabled(SPConfig::OutOfProcess)) {
         // Handle outgoing binding setup.
@@ -139,7 +165,7 @@ SAML2LogoutInitiator::SAML2LogoutInitiator(const DOMElement* e, const char* appI
             try {
                 auto_ptr_char b(start);
                 MessageEncoder * encoder =
-                    SAMLConfig::getConfig().MessageEncoderManager.newPlugin(b.get(),pair<const DOMElement*,const XMLCh*>(e,nullptr));
+                    SAMLConfig::getConfig().MessageEncoderManager.newPlugin(b.get(), pair<const DOMElement*,const XMLCh*>(getElement(), nullptr));
                 if (encoder->isUserAgentPresent() && XMLString::equals(getProtocolFamily(), encoder->getProtocolFamily())) {
                     m_encoders[start] = encoder;
                     m_log.debug("supporting outgoing binding (%s)", b.get());
@@ -159,26 +185,8 @@ SAML2LogoutInitiator::SAML2LogoutInitiator(const DOMElement* e, const char* appI
         }
     }
 #endif
-
-    pair<bool,const char*> loc = getString("Location");
-    if (loc.first) {
-        string address = m_appId + loc.second + "::run::SAML2LI";
-        setAddress(address.c_str());
-    }
 }
 
-void SAML2LogoutInitiator::setParent(const PropertySet* parent)
-{
-    DOMPropertySet::setParent(parent);
-    pair<bool,const char*> loc = getString("Location");
-    if (loc.first) {
-        string address = m_appId + loc.second + "::run::SAML2LI";
-        setAddress(address.c_str());
-    }
-    else {
-        m_log.warn("no Location property in SAML2 LogoutInitiator (or parent), can't register as remoted handler");
-    }
-}
 
 pair<bool,long> SAML2LogoutInitiator::run(SPRequest& request, bool isHandler) const
 {
diff --git a/shibsp/handler/impl/SAML2SessionInitiator.cpp b/shibsp/handler/impl/SAML2SessionInitiator.cpp
index 96e3fca..cea35ea 100644
--- a/shibsp/handler/impl/SAML2SessionInitiator.cpp
+++ b/shibsp/handler/impl/SAML2SessionInitiator.cpp
@@ -72,6 +72,8 @@ namespace shibsp {
 #endif
         }
 
+        void init(const char* location);    // encapsulates actions that need to run either in the c'tor or setParent
+
         void setParent(const PropertySet* parent);
         void receive(DDF& in, ostream& out);
         pair<bool,long> unwrap(SPRequest& request, DDF& out) const;
@@ -127,28 +129,61 @@ namespace shibsp {
 
 SAML2SessionInitiator::SAML2SessionInitiator(const DOMElement* e, const char* appId)
     : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".SessionInitiator.SAML2"), nullptr, &m_remapper), m_appId(appId),
-        m_paosNS(samlconstants::PAOS_NS), m_ecpNS(samlconstants::SAML20ECP_NS), m_paosBinding(samlconstants::SAML20_BINDING_PAOS)
-{
-    static const XMLCh ECP[] = UNICODE_LITERAL_3(E,C,P);
-    const XMLCh* flag = e ? e->getAttributeNS(nullptr,ECP) : nullptr;
-#ifdef SHIBSP_LITE
-    m_ecp = (flag && (*flag == chLatin_t || *flag == chDigit_1));
+        m_paosNS(samlconstants::PAOS_NS), m_ecpNS(samlconstants::SAML20ECP_NS), m_paosBinding(samlconstants::SAML20_BINDING_PAOS),
+#ifndef SHIBSP_LITE
+        m_outgoing(nullptr), m_ecp(nullptr), m_requestTemplate(nullptr)
 #else
-    m_outgoing=nullptr;
-    m_ecp = nullptr;
-    m_requestTemplate=nullptr;
-
+        m_ecp(false)
+#endif
+{
+#ifndef SHIBSP_LITE
     if (SPConfig::getConfig().isEnabled(SPConfig::OutOfProcess)) {
         // Check for a template AuthnRequest to build from.
         DOMElement* child = XMLHelper::getFirstChildElement(e, samlconstants::SAML20P_NS, AuthnRequest::LOCAL_NAME);
         if (child)
             m_requestTemplate = dynamic_cast<AuthnRequest*>(AuthnRequestBuilder::buildOneFromElement(child));
+    }
+#endif
 
+    // If Location isn't set, defer initialization until the setParent call.
+    pair<bool,const char*> loc = getString("Location");
+    if (loc.first) {
+        init(loc.second);
+    }
+
+    m_supportedOptions.insert("isPassive");
+}
+
+void SAML2SessionInitiator::setParent(const PropertySet* parent)
+{
+    DOMPropertySet::setParent(parent);
+    pair<bool,const char*> loc = getString("Location");
+    init(loc.second);
+}
+
+void SAML2SessionInitiator::init(const char* location)
+{
+    if (location) {
+        string address = m_appId + location + "::run::SAML2SI";
+        setAddress(address.c_str());
+    }
+    else {
+        m_log.warn("no Location property in SAML2 SessionInitiator (or parent), can't register as remoted handler");
+    }
+
+    pair<bool,bool> flag = getBool("ECP");
+#ifdef SHIBSP_LITE
+    m_ecp = flag.first && flag.second;
+#else
+    m_outgoing=nullptr;
+    m_ecp = nullptr;
+
+    if (SPConfig::getConfig().isEnabled(SPConfig::OutOfProcess)) {
         // If directed, build an ECP encoder.
-        if (flag && (*flag == chLatin_t || *flag == chDigit_1)) {
+        if (flag.first && flag.second) {
             try {
                 m_ecp = SAMLConfig::getConfig().MessageEncoderManager.newPlugin(
-                    samlconstants::SAML20_BINDING_PAOS, pair<const DOMElement*,const XMLCh*>(e,nullptr)
+                    samlconstants::SAML20_BINDING_PAOS, pair<const DOMElement*,const XMLCh*>(getElement(), nullptr)
                     );
             }
             catch (exception& ex) {
@@ -179,7 +214,7 @@ SAML2SessionInitiator::SAML2SessionInitiator(const DOMElement* e, const char* ap
             try {
                 auto_ptr_char b(start);
                 MessageEncoder * encoder = SAMLConfig::getConfig().MessageEncoderManager.newPlugin(
-                    b.get(),pair<const DOMElement*,const XMLCh*>(e,nullptr)
+                    b.get(),pair<const DOMElement*,const XMLCh*>(getElement(), nullptr)
                     );
                 if (encoder->isUserAgentPresent() && XMLString::equals(getProtocolFamily(), encoder->getProtocolFamily())) {
                     m_encoders[start] = encoder;
@@ -200,28 +235,6 @@ SAML2SessionInitiator::SAML2SessionInitiator(const DOMElement* e, const char* ap
         }
     }
 #endif
-
-    // If Location isn't set, defer address registration until the setParent call.
-    pair<bool,const char*> loc = getString("Location");
-    if (loc.first) {
-        string address = m_appId + loc.second + "::run::SAML2SI";
-        setAddress(address.c_str());
-    }
-
-    m_supportedOptions.insert("isPassive");
-}
-
-void SAML2SessionInitiator::setParent(const PropertySet* parent)
-{
-    DOMPropertySet::setParent(parent);
-    pair<bool,const char*> loc = getString("Location");
-    if (loc.first) {
-        string address = m_appId + loc.second + "::run::SAML2SI";
-        setAddress(address.c_str());
-    }
-    else {
-        m_log.warn("no Location property in SAML2 SessionInitiator (or parent), can't register as remoted handler");
-    }
 }
 
 pair<bool,long> SAML2SessionInitiator::run(SPRequest& request, string& entityID, bool isHandler) const

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-shibboleth/shibboleth-sp2.git



More information about the Pkg-shibboleth-devel mailing list