[cpp-sp] branch main updated: Inline notification URL handling.

Codeberg noreply at shibboleth.net
Mon Jun 8 23:25:40 UTC 2026


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

codeberg pushed a commit to branch main
in repository cpp-sp.

View the commit online:
https://codeberg.org/Shibboleth/cpp-sp/commit/9933df822389614df6b235640e128310c9c8048a

The following commit(s) were added to refs/heads/main by this push:
     new 9933df82 Inline notification URL handling.
9933df82 is described below

commit 9933df822389614df6b235640e128310c9c8048a
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Mon Jun 8 19:25:15 2026 -0400

    Inline notification URL handling.
---
 shibsp/AbstractSPRequest.cpp          | 72 -----------------------------------
 shibsp/AbstractSPRequest.h            |  1 -
 shibsp/SPRequest.h                    |  8 ----
 shibsp/handler/impl/LogoutHandler.cpp | 15 ++++++--
 4 files changed, 11 insertions(+), 85 deletions(-)

diff --git a/shibsp/AbstractSPRequest.cpp b/shibsp/AbstractSPRequest.cpp
index 0fbbbbd9..15bd70e0 100644
--- a/shibsp/AbstractSPRequest.cpp
+++ b/shibsp/AbstractSPRequest.cpp
@@ -280,78 +280,6 @@ const char* AbstractSPRequest::getHandlerURL(const char* resource) const
     return m_handlerURL.c_str();
 }
 
-string AbstractSPRequest::getNotificationURL(unsigned int index) const
-{
-    // We have to process the underlying setting each call to this method for now.
-    // Given how rarely it would be used, not a big issue.
-    vector<string> locs;
-    split_to_container(locs, getRequestSettings().first->getString(RequestMapper::LOGOUT_NOTIFY_PROP_NAME));
-
-    if (index >= locs.size()) {
-        return string();
-    }
-
-    const char* resource = getRequestURL();
-    if (!resource || (strncasecmp(resource,"http://", 7) && strncasecmp(resource,"https://", 8))) {
-        throw ConfigurationException("Request URL was not absolute.");
-    }
-
-    const char* handler = locs[index].c_str();
-
-    // Should never happen...
-    if (!handler || (*handler!='/' && strncasecmp(handler, "http:", 5) && strncasecmp(handler, "https:", 6))) {
-        throw ConfigurationException("Invalid URL in logoutNotify setting.");
-    }
-
-    // The location can be in one of three formats:
-    //
-    // 1) a full URI:       http://host/foo/bar
-    // 2) a hostless URI:   http:///foo/bar
-    // 3) a relative path:  /foo/bar
-    //
-    // #  Protocol  Host        Path
-    // 1  handler   handler     handler
-    // 2  handler   resource    handler
-    // 3  resource  resource    handler
-
-    const char* path = nullptr;
-
-    // Decide whether to use the handler or the resource for the "protocol"
-    const char* prot;
-    if (*handler != '/') {
-        prot = handler;
-    }
-    else {
-        prot = resource;
-        path = handler;
-    }
-
-    // break apart the "protocol" string into protocol, host, and "the rest"
-    const char* colon=strchr(prot,':');
-    colon += 3;
-    const char* slash=strchr(colon,'/');
-    if (!path) {
-        path = slash;
-    }
-
-    // Compute the actual protocol and store.
-    string notifyURL(prot, colon-prot);
-
-    // create the "host" from either the colon/slash or from the target string
-    // If prot == handler then we're in either #1 or #2, else #3.
-    // If slash == colon then we're in #2.
-    if (prot != handler || slash == colon) {
-        colon = strchr(resource, ':');
-        colon += 3;      // Get past the ://
-        slash = strchr(colon, '/');
-    }
-    string host(colon, (slash ? slash-colon : strlen(colon)));
-
-    // Build the URL
-    notifyURL += host + path;
-    return notifyURL;
-}
-
 void AbstractSPRequest::limitRedirect(const char* url) const
 {
     // TODO: come up with some way to optmize/cache this if possible.
diff --git a/shibsp/AbstractSPRequest.h b/shibsp/AbstractSPRequest.h
index a3547044..a676b5c8 100644
--- a/shibsp/AbstractSPRequest.h
+++ b/shibsp/AbstractSPRequest.h
@@ -83,7 +83,6 @@ namespace shibsp {
         std::vector<const char*>::size_type getParameters(const char* name, std::vector<const char*>& values) const;
         const std::map<std::string,std::string>& getCookies() const;
         const char* getHandlerURL(const char* resource=nullptr) const;
-        std::string getNotificationURL(unsigned int index) const;
 
         std::string getSecureHeader(const char* name) const;
         void setAuthType(const char* authtype);
diff --git a/shibsp/SPRequest.h b/shibsp/SPRequest.h
index d7800c99..d759897e 100644
--- a/shibsp/SPRequest.h
+++ b/shibsp/SPRequest.h
@@ -110,14 +110,6 @@ namespace shibsp {
          */
         virtual const char* getHandlerURL(const char* resource=nullptr) const=0;
 
-        /**
-         * Returns the "next" notification URL, or an empty string if no more locations are specified.
-         *
-         * @param index zero-based index of URL to return
-         * @return  the designated URL, or an empty string
-         */
-        virtual std::string getNotificationURL(unsigned int index) const=0;
-
         /**
          * Returns a non-spoofable request header value, if possible.
          * Platforms that support environment export can redirect header
diff --git a/shibsp/handler/impl/LogoutHandler.cpp b/shibsp/handler/impl/LogoutHandler.cpp
index 62ac2346..f072581f 100644
--- a/shibsp/handler/impl/LogoutHandler.cpp
+++ b/shibsp/handler/impl/LogoutHandler.cpp
@@ -23,6 +23,7 @@
 #include "AgentConfig.h"
 #include "SPRequest.h"
 #include "handler/LogoutHandler.h"
+#include "util/Misc.h"
 #include "util/URLEncoder.h"
 
 #include <fstream>
@@ -55,12 +56,18 @@ pair<bool,long> LogoutHandler::notifyFrontChannel(SPRequest& request, bool conti
     // "return" is a backwards-compatible "eventual destination" to go back to after logout completes.
     param = request.getParameter("return");
 
-    // Fetch the next front notification URL and bump the index for the next round trip.
-    string loc = request.getNotificationURL(index++);
-    if (loc.empty()) {
-        return make_pair(false,0L);
+    // We have to process the underlying setting each call to this method for now.
+    // Given how rarely it would be used, not a big issue.
+    vector<string> locs;
+    split_to_container(locs, request.getRequestSettings().first->getString(RequestMapper::LOGOUT_NOTIFY_PROP_NAME));
+
+    if (index >= locs.size()) {
+        return make_pair(false, 0L);
     }
 
+    // Fetch the next front notification URL and bump the index for the next round trip.
+    string loc = locs[index++];
+
     const URLEncoder& encoder = AgentConfig::getConfig().getURLEncoder();
 
     // Start with an "action" telling the application what this is about.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list