Logging category cleanup.
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Thu, 9 Aug 2007 17:57:32 +0000 (17:57 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Thu, 9 Aug 2007 17:57:32 +0000 (17:57 +0000)
Clear session cookie during logout.

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

shibsp/handler/LogoutHandler.h
shibsp/handler/impl/ChainingLogoutInitiator.cpp
shibsp/handler/impl/ChainingSessionInitiator.cpp
shibsp/handler/impl/LocalLogoutInitiator.cpp
shibsp/handler/impl/SAML2Logout.cpp
shibsp/handler/impl/SAML2LogoutInitiator.cpp
shibsp/handler/impl/SAML2SessionInitiator.cpp
shibsp/handler/impl/SAMLDSSessionInitiator.cpp
shibsp/handler/impl/Shib1SessionInitiator.cpp
shibsp/handler/impl/WAYFSessionInitiator.cpp

index 8c79666..8246aae 100644 (file)
@@ -94,18 +94,6 @@ namespace shibsp {
             ) const;
 
         /**
-         * Sends a response template to the user agent informing it of the results of a logout attempt.
-         *
-         * @param application   the Application to use in determining the logout template
-         * @param response      the HTTP response to use
-         * @param local         true iff the logout operation was local to the SP, false iff global
-         * @param status        optional logoutStatus key value to add to template
-         */
-        std::pair<bool,long> sendLogoutPage(
-            const Application& application, xmltooling::HTTPResponse& response, bool local=true, const char* status=NULL
-            ) const;
-
-        /**
          * Perform back-channel logout notifications for an Application.
          *
          * @param application   the Application to notify
@@ -117,6 +105,18 @@ namespace shibsp {
         bool notifyBackChannel(
             const Application& application, const char* requestURL, const std::vector<std::string>& sessions, bool local
             ) const;
+
+        /**
+         * Sends a response template to the user agent informing it of the results of a logout attempt.
+         *
+         * @param application   the Application to use in determining the logout template
+         * @param response      the HTTP response to use
+         * @param local         true iff the logout operation was local to the SP, false iff global
+         * @param status        optional logoutStatus key value to add to template
+         */
+        std::pair<bool,long> sendLogoutPage(
+            const Application& application, xmltooling::HTTPResponse& response, bool local=true, const char* status=NULL
+            ) const;
     };
 
 #if defined (_MSC_VER)
index c81fdfa..0632262 100644 (file)
@@ -80,7 +80,7 @@ namespace shibsp {
 };
 
 ChainingLogoutInitiator::ChainingLogoutInitiator(const DOMElement* e, const char* appId)
-    : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".LogoutInitiator"), &g_LINFilter)
+    : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".LogoutInitiator.Chaining"), &g_LINFilter)
 {
     SPConfig& conf = SPConfig::getConfig();
 
index 803e776..951d790 100644 (file)
@@ -80,7 +80,7 @@ namespace shibsp {
 };
 
 ChainingSessionInitiator::ChainingSessionInitiator(const DOMElement* e, const char* appId)
-    : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".SessionInitiator"), &g_SINFilter)
+    : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".SessionInitiator.Chaining"), &g_SINFilter)
 {
     SPConfig& conf = SPConfig::getConfig();
 
index e048f0b..e541784 100644 (file)
@@ -62,7 +62,7 @@ namespace shibsp {
 };
 
 LocalLogoutInitiator::LocalLogoutInitiator(const DOMElement* e, const char* appId)
-    : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".LogoutInitiator")), m_appId(appId)
+    : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".LogoutInitiator.Local")), m_appId(appId)
 {
     pair<bool,const char*> loc = getString("Location");
     if (loc.first) {
@@ -102,6 +102,10 @@ pair<bool,long> LocalLogoutInitiator::run(SPRequest& request, bool isHandler) co
             return sendLogoutPage(request.getApplication(), request, true, "Partial logout failure.");
         }
         request.getServiceProvider().getSessionCache()->remove(session_id, request.getApplication());
+
+        // Clear the cookie.
+        pair<string,const char*> shib_cookie=request.getApplication().getCookieNameProps("_shibsession_");
+        request.setCookie(shib_cookie.first.c_str(), shib_cookie.second);
     }
 
     return sendLogoutPage(request.getApplication(), request, true, "Logout was successful.");
index 0240946..3f863c6 100644 (file)
@@ -242,8 +242,12 @@ pair<bool,long> SAML2Logout::doRequest(
         // This is returning from a front-channel notification, so we have to do the back-channel and then
         // respond. To do that, we need state from the original request.
         if (!request.getParameter("entityID")) {
-            if (session_id)
+            if (session_id) {
                 cache->remove(session_id, application);
+                // Clear the cookie.
+                pair<string,const char*> shib_cookie=application.getCookieNameProps("_shibsession_");
+                response.setCookie(shib_cookie.first.c_str(), shib_cookie.second);
+            }
             throw FatalProfileException("Application notification loop did not return entityID for LogoutResponse.");
         }
 
@@ -259,6 +263,10 @@ pair<bool,long> SAML2Logout::doRequest(
             catch (exception& ex) {
                 m_log.error("error removing session (%s): %s", session_id, ex.what());
             }
+
+            // Clear the cookie.
+            pair<string,const char*> shib_cookie=application.getCookieNameProps("_shibsession_");
+            response.setCookie(shib_cookie.first.c_str(), shib_cookie.second);
         }
         else {
             worked1 = worked2 = true;
@@ -461,6 +469,10 @@ pair<bool,long> SAML2Logout::doRequest(
             catch (exception& ex) {
                 m_log.error("error removing active session (%s): %s", session_id, ex.what());
             }
+
+            // Clear the cookie.
+            pair<string,const char*> shib_cookie=application.getCookieNameProps("_shibsession_");
+            response.setCookie(shib_cookie.first.c_str(), shib_cookie.second);
         }
 
         return sendResponse(
index 527ae3d..ceedd99 100644 (file)
@@ -98,7 +98,7 @@ namespace shibsp {
 };
 
 SAML2LogoutInitiator::SAML2LogoutInitiator(const DOMElement* e, const char* appId)
-    : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".LogoutInitiator")), m_appId(appId),
+    : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".LogoutInitiator.SAML2")), m_appId(appId),
 #ifndef SHIBSP_LITE
         m_outgoing(NULL),
 #endif
@@ -270,6 +270,10 @@ pair<bool,long> SAML2LogoutInitiator::doRequest(
         return sendLogoutPage(application, response, true, "Partial logout failure.");
     }
 
+    // Clear the cookie.
+    pair<string,const char*> shib_cookie=application.getCookieNameProps("_shibsession_");
+    response.setCookie(shib_cookie.first.c_str(), shib_cookie.second);
+
 #ifndef SHIBSP_LITE
     pair<bool,long> ret = make_pair(false,0);
     try {
index 0992d4d..baa27cf 100644 (file)
@@ -107,7 +107,7 @@ namespace shibsp {
 };
 
 SAML2SessionInitiator::SAML2SessionInitiator(const DOMElement* e, const char* appId)
-    : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".SessionInitiator")), m_appId(appId)
+    : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".SessionInitiator.SAML2")), m_appId(appId)
 {
 #ifndef SHIBSP_LITE
     m_outgoing=NULL;
index 42614f1..3d95f22 100644 (file)
@@ -46,7 +46,7 @@ namespace shibsp {
     {
     public:
         SAMLDSSessionInitiator(const DOMElement* e, const char* appId)
-                : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".SessionInitiator")), m_url(NULL), m_returnParam(NULL) {
+                : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".SessionInitiator.SAMLDS")), m_url(NULL), m_returnParam(NULL) {
             pair<bool,const char*> url = getString("URL");
             if (!url.first)
                 throw ConfigurationException("SAMLDS SessionInitiator requires a URL property.");
index e7564e9..6e122fb 100644 (file)
@@ -54,7 +54,7 @@ namespace shibsp {
     {
     public:
         Shib1SessionInitiator(const DOMElement* e, const char* appId)
-                : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".SessionInitiator")), m_appId(appId) {
+                : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".SessionInitiator.Shib1")), m_appId(appId) {
             // If Location isn't set, defer address registration until the setParent call.
             pair<bool,const char*> loc = getString("Location");
             if (loc.first) {
index 03f0ea2..49f1242 100644 (file)
@@ -47,7 +47,7 @@ namespace shibsp {
     {
     public:
         WAYFSessionInitiator(const DOMElement* e, const char* appId)
-                : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".SessionInitiator")), m_url(NULL) {
+                : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT".SessionInitiator.WAYF")), m_url(NULL) {
             pair<bool,const char*> url = getString("URL");
             if (!url.first)
                 throw ConfigurationException("WAYF SessionInitiator requires a URL property.");