[cpp-sp] branch main updated: Drop passive tracking hack.

Scott Cantor cantor.2 at osu.edu
Tue Sep 23 19:18:42 UTC 2025


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

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

View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=3d22763fc1e84bc705b14326e8a2bd97e2d34767

The following commit(s) were added to refs/heads/main by this push:
     new 3d22763f Drop passive tracking hack.
3d22763f is described below

commit 3d22763fc1e84bc705b14326e8a2bd97e2d34767
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Sep 23 15:18:39 2025 -0400

    Drop passive tracking hack.
---
 shibsp/exceptions.cpp                            |  2 +-
 shibsp/exceptions.h                              |  2 +-
 shibsp/handler/impl/TokenConsumer.cpp            | 19 ++++++++-----------
 shibsp/remoting/impl/AbstractRemotingService.cpp |  8 ++------
 4 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/shibsp/exceptions.cpp b/shibsp/exceptions.cpp
index da709463..67097655 100644
--- a/shibsp/exceptions.cpp
+++ b/shibsp/exceptions.cpp
@@ -32,7 +32,7 @@ using namespace shibsp;
 using namespace std;
 
 const char AgentException::HANDLER_TYPE_PROP_NAME[] = "handlerType";
-const char AgentException::PASSIVE_PROP_NAME[] = "passive";
+const char AgentException::EVENT_PROP_NAME[] = "event";
 const char AgentException::TARGET_PROP_NAME[] = "target";
 
 AgentException::AgentException(const char* msg) : m_status(HTTPResponse::SHIBSP_HTTP_STATUS_ERROR)
diff --git a/shibsp/exceptions.h b/shibsp/exceptions.h
index 0a1d607c..5a6c59d5 100644
--- a/shibsp/exceptions.h
+++ b/shibsp/exceptions.h
@@ -144,7 +144,7 @@ namespace shibsp {
 
         // Defined properties.
         static const char HANDLER_TYPE_PROP_NAME[];
-        static const char PASSIVE_PROP_NAME[];
+        static const char EVENT_PROP_NAME[];
         static const char TARGET_PROP_NAME[];
 
     private:
diff --git a/shibsp/handler/impl/TokenConsumer.cpp b/shibsp/handler/impl/TokenConsumer.cpp
index 02e99571..1d287bf3 100644
--- a/shibsp/handler/impl/TokenConsumer.cpp
+++ b/shibsp/handler/impl/TokenConsumer.cpp
@@ -73,9 +73,8 @@ TokenConsumer::TokenConsumer(const ptree& pt, const char* path)
 
 pair<bool,long> TokenConsumer::run(SPRequest& request, bool isHandler) const
 {
-    // TODO: check for sessio hook return to break loop.
+    // TODO: check for session hook return to break loop.
 
-    bool wasPassive;
     string target;
 
     try {
@@ -92,7 +91,6 @@ pair<bool,long> TokenConsumer::run(SPRequest& request, bool isHandler) const
         DDF output = request.getAgent().getRemotingService()->send(input);
         DDFJanitor outputJanitor(output);
 
-        wasPassive = output["passive"].integer() == 1;
         const char* s = output.getmember("http.redirect").string();
         if (s) {
             target = s;
@@ -149,21 +147,17 @@ pair<bool,long> TokenConsumer::run(SPRequest& request, bool isHandler) const
             agent_ex->addProperty(AgentException::HANDLER_TYPE_PROP_NAME, TOKEN_CONSUMER_HANDLER);
         }
         
-        // THis is a mess to allow for "ignoring" errors during passive SSO and routing back
+        // This is a mess to allow for "ignoring" errors during passive SSO and routing back
         // to the original resource.
 
-        // The passive and target values can come from the output message or the exception.
-        // When the cache throws, the error typically would not carry that information but the
-        // output would have.
-
-        const char* passive = agent_ex ? agent_ex->getProperty(AgentException::PASSIVE_PROP_NAME) : nullptr;
-        if (wasPassive || (passive && !strcmp(passive, "1"))) {
-            agent_ex->log(request, Priority::SHIB_WARN);
+        const char* event = agent_ex ? agent_ex->getProperty(AgentException::EVENT_PROP_NAME) : nullptr;
+        if (event && !strcmp(event, "NoPassive")) {
             const char* error_target = target.empty() ? agent_ex->getProperty(AgentException::TARGET_PROP_NAME) : target.c_str();
 
             // TODO: either recover POST data or clean up recovery state?
 
             if (error_target) {
+                agent_ex->log(request, Priority::SHIB_WARN);
                 request.limitRedirect(error_target);
                 // Make sure the target isn't a prefix of this handler, to avoid a loop.
                 if (boost::starts_with(error_target, request.getRequestURL())) {
@@ -173,6 +167,9 @@ pair<bool,long> TokenConsumer::run(SPRequest& request, bool isHandler) const
                     return make_pair(true, request.sendRedirect(error_target));
                 }
             }
+            else {
+                request.warn("TokenConsumer caught NoPassive error but had no target to redirect to");
+            }
         }
         throw;
     }
diff --git a/shibsp/remoting/impl/AbstractRemotingService.cpp b/shibsp/remoting/impl/AbstractRemotingService.cpp
index a5d2b11b..f53170da 100644
--- a/shibsp/remoting/impl/AbstractRemotingService.cpp
+++ b/shibsp/remoting/impl/AbstractRemotingService.cpp
@@ -47,17 +47,13 @@ DDF AbstractRemotingService::send(const DDF& in) const
     const char* event = output.getmember("event").string();
     if (event && strcmp(event, "success")) {
         OperationException ex("Remote operation was unsuccessful.");
-        ex.addProperty("event", event);
+        ex.addProperty(AgentException::EVENT_PROP_NAME, event);
         if (in.name()) {
             ex.addProperty("operation", in.name());
         }
         const char* target = output.getmember("target").string();
         if (target) {
-            ex.addProperty("target", target);
-        }
-
-        if (output.getmember("passive").integer() == 1) {
-            ex.addProperty("passive", "1");
+            ex.addProperty(AgentException::TARGET_PROP_NAME, target);
         }
 
         output.destroy();

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


More information about the commits mailing list