[cpp-sp] branch main updated: Factor out header remoting control to base class.
Codeberg
noreply at shibboleth.net
Mon Jun 8 18:34:26 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/62a7b8f3db88f93c38188cd2368740619dfbdd2f
The following commit(s) were added to refs/heads/main by this push:
new 62a7b8f3 Factor out header remoting control to base class.
62a7b8f3 is described below
commit 62a7b8f3db88f93c38188cd2368740619dfbdd2f
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Mon Jun 8 14:03:44 2026 -0400
Factor out header remoting control to base class.
---
shibsp/handler/AbstractHandler.h | 13 ++++++++++++-
shibsp/handler/impl/AbstractHandler.cpp | 15 ++++++++++++++-
shibsp/handler/impl/LogoutConsumer.cpp | 3 +--
shibsp/handler/impl/LogoutInitiator.cpp | 3 +--
shibsp/handler/impl/SessionInitiator.cpp | 5 ++---
shibsp/handler/impl/TokenConsumer.cpp | 13 ++-----------
6 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/shibsp/handler/AbstractHandler.h b/shibsp/handler/AbstractHandler.h
index 83dc3382..0c5b9972 100644
--- a/shibsp/handler/AbstractHandler.h
+++ b/shibsp/handler/AbstractHandler.h
@@ -25,8 +25,9 @@
#include <shibsp/remoting/ddf.h>
#include <shibsp/util/BoostPropertySet.h>
-#include <string>
#include <set>
+#include <string>
+
#include <boost/property_tree/ptree_fwd.hpp>
namespace shibsp {
@@ -149,9 +150,19 @@ namespace shibsp {
public:
virtual ~AbstractHandler();
+ protected:
+ /**
+ * Gets the set of request headers to remote to Hub during calls.
+ *
+ * @return set of request headers to remote
+ */
+ const std::set<std::string>& getRemotedHeaders() const;
+
private:
std::string getPostCookieName(const SPRequest& request, const char* relayState) const;
DDF getPostData(const SPRequest& request) const;
+
+ std::set<std::string> m_remotedHeaders;
};
#if defined (_MSC_VER)
diff --git a/shibsp/handler/impl/AbstractHandler.cpp b/shibsp/handler/impl/AbstractHandler.cpp
index 7ae09e6e..b170e3c8 100644
--- a/shibsp/handler/impl/AbstractHandler.cpp
+++ b/shibsp/handler/impl/AbstractHandler.cpp
@@ -99,14 +99,27 @@ Handler::~Handler()
{
}
-AbstractHandler::AbstractHandler(const ptree& pt) {
+AbstractHandler::AbstractHandler(const ptree& pt) : m_remotedHeaders({ "Cookie" }) {
load(pt);
+
+ 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");
+ }
+
}
AbstractHandler::~AbstractHandler()
{
}
+const set<string>& AbstractHandler::getRemotedHeaders() const
+{
+ return m_remotedHeaders;
+}
const char* Handler::getEventType() const
{
diff --git a/shibsp/handler/impl/LogoutConsumer.cpp b/shibsp/handler/impl/LogoutConsumer.cpp
index 621fbb2c..e9b9f25b 100644
--- a/shibsp/handler/impl/LogoutConsumer.cpp
+++ b/shibsp/handler/impl/LogoutConsumer.cpp
@@ -110,8 +110,7 @@ pair<bool,long> LogoutConsumer::run(SPRequest& request, bool isHandler) const
}
}
- static set<string> emptyHeaderSet;
- DDF wrapped = wrapRequest(request, emptyHeaderSet, false);
+ DDF wrapped = wrapRequest(request, getRemotedHeaders(), false);
input.add(wrapped);
input.addmember("home_url").unsafe_string(getHomeURL(request));
diff --git a/shibsp/handler/impl/LogoutInitiator.cpp b/shibsp/handler/impl/LogoutInitiator.cpp
index a2759328..562d8d1e 100644
--- a/shibsp/handler/impl/LogoutInitiator.cpp
+++ b/shibsp/handler/impl/LogoutInitiator.cpp
@@ -95,8 +95,7 @@ pair<bool,long> LogoutInitiator::run(SPRequest& request, bool isHandler) const
input.addmember("target").unsafe_string(dest);
}
- static set<string> emptyHeaderSet;
- DDF wrapped = wrapRequest(request, emptyHeaderSet, false);
+ DDF wrapped = wrapRequest(request, getRemotedHeaders(), false);
input.add(wrapped);
try {
diff --git a/shibsp/handler/impl/SessionInitiator.cpp b/shibsp/handler/impl/SessionInitiator.cpp
index b8f48709..0bc41f2b 100644
--- a/shibsp/handler/impl/SessionInitiator.cpp
+++ b/shibsp/handler/impl/SessionInitiator.cpp
@@ -50,7 +50,6 @@ namespace {
string m_path;
bool m_discoveryEnabled;
- set<string> m_remotedHeaders;
vector<string> m_requestMapperSettings;
vector<string> m_querySettings;
};
@@ -63,7 +62,7 @@ namespace shibsp {
};
SessionInitiator::SessionInitiator(const ptree& pt, const char* path)
- : AbstractHandler(pt), m_path(path), m_discoveryEnabled(true), m_remotedHeaders({ "Cookie" })
+ : AbstractHandler(pt), m_path(path), m_discoveryEnabled(true)
{
static const char DISCOVERY_ENABLED_PROP_NAME[] = "discoveryEnabled";
static const char REQUEST_MAPPER_SETTINGS_PROP_NAME[] = "requestMapperSettings";
@@ -176,7 +175,7 @@ pair<bool,long> SessionInitiator::run(SPRequest& request, bool isHandler) const
settings->getString(RequestMapper::HANDLER_CONFIG_ID_PROP_NAME)).getTokenConsumerInfo(handlerBaseURL);
input.add(dup);
- DDF wrapped = wrapRequest(request, m_remotedHeaders,
+ DDF wrapped = wrapRequest(request, getRemotedHeaders(),
!isHandler && getBool(RequestMapper::PRESERVE_POST_DATA_PROP_NAME,
request,
RequestMapper::PRESERVE_POST_DATA_PROP_DEFAULT,
diff --git a/shibsp/handler/impl/TokenConsumer.cpp b/shibsp/handler/impl/TokenConsumer.cpp
index 707877ce..23435e37 100644
--- a/shibsp/handler/impl/TokenConsumer.cpp
+++ b/shibsp/handler/impl/TokenConsumer.cpp
@@ -50,7 +50,6 @@ namespace {
private:
string m_path;
- set<string> m_remotedHeaders;
};
};
@@ -60,16 +59,8 @@ namespace shibsp {
}
};
-TokenConsumer::TokenConsumer(const ptree& pt, const char* path)
- : AbstractHandler(pt), m_path(path), m_remotedHeaders({ "Cookie" })
+TokenConsumer::TokenConsumer(const ptree& pt, const char* path) : AbstractHandler(pt), m_path(path)
{
- 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
@@ -103,7 +94,7 @@ pair<bool,long> TokenConsumer::run(SPRequest& request, bool isHandler) const
DDF input = request.getAgent().getRemotingService()->build("token-consumer", request);
DDFJanitor inputJanitor(input);
- DDF wrapped = wrapRequest(request, m_remotedHeaders);
+ DDF wrapped = wrapRequest(request, getRemotedHeaders());
input.add(wrapped);
input.addmember("home_url").unsafe_string(
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list