[cpp-sp] branch main updated: Some constants, implement extension setting in token handler.

Scott Cantor cantor.2 at osu.edu
Mon Jul 21 15:05:58 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=610123c86198fccba14644d9c1bd9936203fb7f1

The following commit(s) were added to refs/heads/main by this push:
     new 610123c8 Some constants, implement extension setting in token handler.
610123c8 is described below

commit 610123c86198fccba14644d9c1bd9936203fb7f1
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Jul 21 11:05:33 2025 -0400

    Some constants, implement extension setting in token handler.
---
 shibsp/handler/AbstractHandler.h                    |  4 ++--
 shibsp/handler/impl/AbstractHandler.cpp             |  2 +-
 shibsp/handler/impl/DefaultHandlerConfiguration.cpp |  6 ++++--
 shibsp/handler/impl/SessionInitiator.cpp            |  2 +-
 shibsp/handler/impl/TokenConsumer.cpp               | 10 +++++++++-
 5 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/shibsp/handler/AbstractHandler.h b/shibsp/handler/AbstractHandler.h
index 1e410ab6..0cbb2fb9 100644
--- a/shibsp/handler/AbstractHandler.h
+++ b/shibsp/handler/AbstractHandler.h
@@ -26,7 +26,7 @@
 #include <shibsp/util/BoostPropertySet.h>
 
 #include <string>
-#include <vector>
+#include <set>
 #include <boost/property_tree/ptree_fwd.hpp>
 
 namespace shibsp {
@@ -62,7 +62,7 @@ namespace shibsp {
          * @return wrapped structure to add to remoted data
          */
         virtual DDF wrapRequest(
-            const SPRequest& request, const std::vector<std::string>& headers, bool sendBody=true
+            const SPRequest& request, const std::set<std::string>& headers, bool sendBody=true
             ) const;
 
         /**
diff --git a/shibsp/handler/impl/AbstractHandler.cpp b/shibsp/handler/impl/AbstractHandler.cpp
index 9c341206..b740d4c7 100644
--- a/shibsp/handler/impl/AbstractHandler.cpp
+++ b/shibsp/handler/impl/AbstractHandler.cpp
@@ -120,7 +120,7 @@ const char* Handler::getEventType() const
     return nullptr;
 }
 
-DDF AbstractHandler::wrapRequest(const SPRequest& request, const vector<string>& headers, bool sendBody) const
+DDF AbstractHandler::wrapRequest(const SPRequest& request, const set<string>& headers, bool sendBody) const
 {
     DDF in = DDF("http").structure();
     in.addmember("scheme").string(request.getScheme());
diff --git a/shibsp/handler/impl/DefaultHandlerConfiguration.cpp b/shibsp/handler/impl/DefaultHandlerConfiguration.cpp
index abe6458c..7843a677 100644
--- a/shibsp/handler/impl/DefaultHandlerConfiguration.cpp
+++ b/shibsp/handler/impl/DefaultHandlerConfiguration.cpp
@@ -57,6 +57,8 @@ namespace {
         DDF m_tokenConsumerConfig;
     };
 
+    static const char TYPE_PROP_NAME[] = "type";
+    static const char LEGACY_BINDING_PROP_NAME[] = "legacyBinding";
 };
 
 HandlerConfiguration::HandlerConfiguration() {}
@@ -78,7 +80,7 @@ DefaultHandlerConfiguration::DefaultHandlerConfiguration(const char* pathname)
             continue;
         }
         
-        boost::optional<string> type = child.second.get_optional<string>("type");
+        boost::optional<string> type = child.second.get_optional<string>(TYPE_PROP_NAME);
         if (!type) {
             log.warn("config (%s) skipping handler at %s with no type property", pathname, child.first.c_str());
             continue;
@@ -112,7 +114,7 @@ DefaultHandlerConfiguration::DefaultHandlerConfiguration(const char* pathname)
             m_tokenConsumerConfig.add(tokenConsumer);
 
             // Check for legacy "binding" value to carry along with path as the name of the node.
-            boost::optional<string> legacyBinding = child.second.get_optional<string>("legacyBinding");
+            boost::optional<string> legacyBinding = child.second.get_optional<string>(LEGACY_BINDING_PROP_NAME);
             if (legacyBinding) {
                 tokenConsumer.name(legacyBinding->c_str());
             }
diff --git a/shibsp/handler/impl/SessionInitiator.cpp b/shibsp/handler/impl/SessionInitiator.cpp
index 13f84b83..1646ee5d 100644
--- a/shibsp/handler/impl/SessionInitiator.cpp
+++ b/shibsp/handler/impl/SessionInitiator.cpp
@@ -48,7 +48,7 @@ namespace {
 
         string m_path;
         bool m_discoveryEnabled;
-        vector<string> m_remotedHeaders;
+        set<string> m_remotedHeaders;
         vector<string> m_requestMapperSettings;
         vector<string> m_querySettings;
     };
diff --git a/shibsp/handler/impl/TokenConsumer.cpp b/shibsp/handler/impl/TokenConsumer.cpp
index c2fbba67..11bc229b 100644
--- a/shibsp/handler/impl/TokenConsumer.cpp
+++ b/shibsp/handler/impl/TokenConsumer.cpp
@@ -27,6 +27,7 @@
 #include "logging/Category.h"
 #include "session/SessionCache.h"
 #include "remoting/RemotingService.h"
+#include "util/Misc.h"
 #include "util/URLEncoder.h"
 
 #include <ctime>
@@ -48,7 +49,7 @@ namespace {
 
     private:
         string m_path;
-        vector<string> m_remotedHeaders;
+        set<string> m_remotedHeaders;
     };
 };
 
@@ -61,6 +62,13 @@ namespace shibsp {
 TokenConsumer::TokenConsumer(const ptree& pt, const char* path)
     : AbstractHandler(pt), m_path(path), m_remotedHeaders({ "Cookie" })
 {
+    static const char REMOTED_HEADERS_PROP_NAME[] = "remotedHeaders";
+
+    const char* headers = getString(REMOTED_HEADERS_PROP_NAME);
+    if (headers) {
+        split_to_container(m_remotedHeaders, headers);
+        m_remotedHeaders.insert("Cookie");
+    }
 }
 
 pair<bool,long> TokenConsumer::run(SPRequest& request, bool isHandler) const

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


More information about the commits mailing list