Make sure logout notification only happens in one handler.
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Thu, 12 Jul 2007 17:42:07 +0000 (17:42 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Thu, 12 Jul 2007 17:42:07 +0000 (17:42 +0000)
Get remoting working in local logout handler.

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

apache/mod_apache.cpp
shibsp/handler/impl/ChainingLogoutInitiator.cpp
shibsp/handler/impl/LocalLogoutInitiator.cpp
shibsp/handler/impl/LogoutHandler.cpp
shibsp/impl/XMLServiceProvider.cpp
shibsp/util/DOMPropertySet.h
shibsp/util/PropertySet.h

index 3522600..08fb663 100644 (file)
@@ -657,6 +657,7 @@ public:
     void unlock() { m_staKey->setData(NULL); m_propsKey->setData(NULL); m_mapper->unlock(); }
     Settings getSettings(const SPRequest& request) const;
     
+    const PropertySet* getParent() const { return NULL; }
     void setParent(const PropertySet*) {}
     pair<bool,bool> getBool(const char* name, const char* ns=NULL) const;
     pair<bool,const char*> getString(const char* name, const char* ns=NULL) const;
index 0285784..6ca0e7f 100644 (file)
@@ -100,12 +100,6 @@ ChainingLogoutInitiator::ChainingLogoutInitiator(const DOMElement* e, const char
         }
         e = XMLHelper::getNextSiblingElement(e, _LogoutInitiator);
     }
-
-    pair<bool,const char*> loc = getString("Location");
-    if (loc.first) {
-        string address = string(appId) + loc.second + "::run::ChainingLI";
-        setAddress(address.c_str());
-    }
 }
 
 pair<bool,long> ChainingLogoutInitiator::run(SPRequest& request, bool isHandler) const
index 50ccc2f..687dd32 100644 (file)
@@ -45,9 +45,11 @@ namespace shibsp {
         LocalLogoutInitiator(const DOMElement* e, const char* appId);
         virtual ~LocalLogoutInitiator() {}
         
+        void setParent(const PropertySet* parent);
         pair<bool,long> run(SPRequest& request, bool isHandler=true) const;
 
     private:
+        string m_appId;
         vector<Handler*> m_handlers;
     };
 
@@ -62,7 +64,7 @@ namespace shibsp {
 };
 
 LocalLogoutInitiator::LocalLogoutInitiator(const DOMElement* e, const char* appId)
-    : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".LogoutInitiator"))
+    : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".LogoutInitiator")), m_appId(appId)
 {
     pair<bool,const char*> loc = getString("Location");
     if (loc.first) {
@@ -71,6 +73,19 @@ LocalLogoutInitiator::LocalLogoutInitiator(const DOMElement* e, const char* appI
     }
 }
 
+void LocalLogoutInitiator::setParent(const PropertySet* parent)
+{
+    DOMPropertySet::setParent(parent);
+    pair<bool,const char*> loc = getString("Location");
+    if (loc.first) {
+        string address = m_appId + loc.second + "::run::LocalLI";
+        setAddress(address.c_str());
+    }
+    else {
+        m_log.warn("no Location property in Local LogoutInitiator (or parent), can't register as remoted handler");
+    }
+}
+
 pair<bool,long> LocalLogoutInitiator::run(SPRequest& request, bool isHandler) const
 {
     // Defer to base class first.
index 870ab1f..e363c05 100644 (file)
@@ -42,8 +42,8 @@ using namespace std;
 
 pair<bool,long> LogoutHandler::run(SPRequest& request, bool isHandler) const
 {
-    // If no location for this handler, we're inside a chain, so do nothing.
-    if (!getString("Location").first)
+    // If we're inside a chain, so do nothing.
+    if (getParent())
         return make_pair(false,0);
     
     // If this isn't a LogoutInitiator, we only "continue" a notification loop, rather than starting one.
index 5f14445..39c1df4 100644 (file)
@@ -277,6 +277,7 @@ namespace {
         }
 
         // PropertySet
+        const PropertySet* getParent() const { return m_impl->getParent(); }
         void setParent(const PropertySet* parent) {return m_impl->setParent(parent);}
         pair<bool,bool> getBool(const char* name, const char* ns=NULL) const {return m_impl->getBool(name,ns);}
         pair<bool,const char*> getString(const char* name, const char* ns=NULL) const {return m_impl->getString(name,ns);}
index 817a3ed..8777bb1 100644 (file)
@@ -38,6 +38,10 @@ namespace shibsp {
         
         virtual ~DOMPropertySet();
 
+        const PropertySet* getParent() const {
+            return m_parent;
+        }
+
         void setParent(const PropertySet* parent) {
             m_parent = parent;
         }
index 81bc859..eb0f242 100644 (file)
@@ -40,6 +40,13 @@ namespace shibsp {
         virtual ~PropertySet() {}
 
         /**
+         * Returns parent of this PropertySet, if any.
+         *
+         * @return the parent object, or NULL
+         */
+        virtual const PropertySet* getParent() const=0;
+
+        /**
          * Establishes a "parent" PropertySet to supply inherited settings.
          *
          * @param parent    the parent PropertySet to use