[cpp-sp] branch main updated: Move attributeValueDelimiter back to RequestMapper setting.

Scott Cantor cantor.2 at osu.edu
Tue Oct 14 20:17:32 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=872ab8815f96d6a344153c6bff05d1efa7cf197e

The following commit(s) were added to refs/heads/main by this push:
     new 872ab881 Move attributeValueDelimiter back to RequestMapper setting.
872ab881 is described below

commit 872ab8815f96d6a344153c6bff05d1efa7cf197e
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Oct 14 16:17:29 2025 -0400

    Move attributeValueDelimiter back to RequestMapper setting.
---
 shibsp/RequestMapper.h                              |  2 ++
 shibsp/attribute/AttributeConfiguration.h           |  4 ----
 .../impl/DefaultAttributeConfiguration.cpp          | 21 +++++++++------------
 shibsp/handler/impl/SessionHandler.cpp              |  5 ++---
 shibsp/impl/XMLRequestMapper.cpp                    |  2 ++
 5 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/shibsp/RequestMapper.h b/shibsp/RequestMapper.h
index 0edefa0e..c7f9e6c8 100644
--- a/shibsp/RequestMapper.h
+++ b/shibsp/RequestMapper.h
@@ -50,6 +50,7 @@ namespace shibsp {
 
         static const char APPLICATION_ID_PROP_NAME[];
         static const char ATTRIBUTE_CONFIG_ID_PROP_NAME[];
+        static const char ATTRIBUTE_VALUE_DELIMITER_PROP_NAME[];
         static const char AUTH_TYPE_PROP_NAME[];
         static const char CONSISTENT_ADDRESS_PROP_NAME[];
         static const char COOKIE_MAXAGE_PROP_NAME[];
@@ -71,6 +72,7 @@ namespace shibsp {
         static const char USE_VARIABLES_PROP_NAME[];
 
         static const char APPLICATION_ID_PROP_DEFAULT[];
+        static const char ATTRIBUTE_VALUE_DELIMITER_PROP_DEFAULT[];
         static bool CONSISTENT_ADDRESS_PROP_DEFAULT;
         static bool EXPIRE_REDIRECTS_PROP_DEFAULT;
         static unsigned int LIFETIME_PROP_DEFAULT;
diff --git a/shibsp/attribute/AttributeConfiguration.h b/shibsp/attribute/AttributeConfiguration.h
index 29e92569..b7f962ce 100644
--- a/shibsp/attribute/AttributeConfiguration.h
+++ b/shibsp/attribute/AttributeConfiguration.h
@@ -65,10 +65,6 @@ namespace shibsp {
         static const char LEGACY_AUTHTIME_ATTRIBUTE_PROP_NAME[];
         static const char LEGACY_AUTHTIME_ATTRIBUTE_PROP_DEFAULT[];
 
-        /** Delimiter to separate multiple attribute values in exported variables. */
-        static const char VALUE_DELIMITER_PROP_NAME[];
-        static const char VALUE_DELIMITER_PROP_DEFAULT[];
-
         /**
          * Post-process a collection of attributes and values from the hub for use by agent code.
          * 
diff --git a/shibsp/attribute/impl/DefaultAttributeConfiguration.cpp b/shibsp/attribute/impl/DefaultAttributeConfiguration.cpp
index b7815edf..967f5e39 100644
--- a/shibsp/attribute/impl/DefaultAttributeConfiguration.cpp
+++ b/shibsp/attribute/impl/DefaultAttributeConfiguration.cpp
@@ -78,7 +78,6 @@ namespace {
         // Unused ptree if we configure via inline.
         ptree m_pt;
         const char* m_scopeDelimiter;
-        const char* m_valueDelimiter;
         bool m_urlEncoding,m_exportDuplicates,m_partialRegexMatching;
         map<string,string> m_mappings;
         set<string> m_caseInsensitiveIds;
@@ -88,11 +87,9 @@ namespace {
 
 const char AttributeConfiguration::LEGACY_CLASSREF_ATTRIBUTE_PROP_NAME[] = "legacyClassRefAttribute";
 const char AttributeConfiguration::LEGACY_AUTHTIME_ATTRIBUTE_PROP_NAME[] = "legacyAuthnTimeAttribute";
-const char AttributeConfiguration::VALUE_DELIMITER_PROP_NAME[] = "attributeValueDelimiter";
 
 const char AttributeConfiguration::LEGACY_CLASSREF_ATTRIBUTE_PROP_DEFAULT[] = "Shib-AuthnContext-Class";
 const char AttributeConfiguration::LEGACY_AUTHTIME_ATTRIBUTE_PROP_DEFAULT[] = "Shib-Authentication-Instant";
-const char AttributeConfiguration::VALUE_DELIMITER_PROP_DEFAULT[] = ";";
 
 
 AttributeConfiguration::AttributeConfiguration() {}
@@ -147,7 +144,6 @@ void DefaultAttributeConfiguration::init(const ptree& pt)
         split_to_container(m_caseInsensitiveIds, getString(CASE_INSENSITIVE_ATTRS_PROP_NAME, ""));
 
         m_scopeDelimiter = getString(SCOPE_DELIMITER_PROP_NAME, SCOPE_DELIMITER_PROP_DEFAULT);
-        m_valueDelimiter = getString(VALUE_DELIMITER_PROP_NAME, VALUE_DELIMITER_PROP_DEFAULT);
         m_urlEncoding = !strcmp(getString(ENCODING_PROP_NAME, ""), URL_ENCODING_PROP_VALUE);
         m_exportDuplicates = getBool(EXPORT_DUP_VALUES_PROP_NAME, EXPORT_DUP_VALUES_PROP_DEFAULT);
 
@@ -157,7 +153,6 @@ void DefaultAttributeConfiguration::init(const ptree& pt)
     else {
         // Default settings
         m_scopeDelimiter = SCOPE_DELIMITER_PROP_DEFAULT;
-        m_valueDelimiter = VALUE_DELIMITER_PROP_DEFAULT;
         m_urlEncoding = false;
         m_exportDuplicates = EXPORT_DUP_VALUES_PROP_DEFAULT;
         m_partialRegexMatching = Agent::PARTIAL_REGEX_MATCHING_PROP_DEFAULT;
@@ -290,7 +285,9 @@ void DefaultAttributeConfiguration::exportAttributes(SPRequest& request, const S
     RequestMapper::Settings settings = request.getRequestSettings();
     const URLEncoder& encoder = AgentConfig::getConfig().getURLEncoder();
 
-    size_t delim_len = strlen(m_valueDelimiter);
+    const char* delim = settings.first->getString(RequestMapper::ATTRIBUTE_VALUE_DELIMITER_PROP_NAME,
+        RequestMapper::ATTRIBUTE_VALUE_DELIMITER_PROP_DEFAULT);
+    size_t delim_len = strlen(delim);
 
     // Default export strategy will include duplicates.
     if (m_exportDuplicates) {
@@ -313,7 +310,7 @@ void DefaultAttributeConfiguration::exportAttributes(SPRequest& request, const S
             DDF v = vals.first();
             while (!v.isnull()) {
                 if (!header.empty()) {
-                    header += m_valueDelimiter;
+                    header += delim;
                 }
 
                 if (m_urlEncoding) {
@@ -322,9 +319,9 @@ void DefaultAttributeConfiguration::exportAttributes(SPRequest& request, const S
                 }
                 else {
                     string serialized(v.string());
-                    string::size_type pos = serialized.find(m_valueDelimiter, string::size_type(0));
+                    string::size_type pos = serialized.find(delim, string::size_type(0));
                     if (pos != string::npos) {
-                        for (; pos != string::npos; pos = serialized.find(m_valueDelimiter, pos)) {
+                        for (; pos != string::npos; pos = serialized.find(delim, pos)) {
                             serialized.insert(pos, "\\");
                             pos += delim_len + 1;
                         }
@@ -367,16 +364,16 @@ void DefaultAttributeConfiguration::exportAttributes(SPRequest& request, const S
             string header;
             for (const string& v : deduped.second) {
                 if (!header.empty())
-                    header += m_valueDelimiter;
+                    header += delim;
                 if (m_urlEncoding) {
                     // If URL-encoding, any semicolons will get escaped anyway.
                     header += encoder.encode(v.c_str());
                 }
                 else {
-                    string::size_type pos = v.find(m_valueDelimiter, string::size_type(0));
+                    string::size_type pos = v.find(delim, string::size_type(0));
                     if (pos != string::npos) {
                         string value(v);
-                        for (; pos != string::npos; pos = value.find(m_valueDelimiter, pos)) {
+                        for (; pos != string::npos; pos = value.find(delim, pos)) {
                             value.insert(pos, "\\");
                             pos += delim_len + 1;
                         }
diff --git a/shibsp/handler/impl/SessionHandler.cpp b/shibsp/handler/impl/SessionHandler.cpp
index b11aa099..2c660482 100644
--- a/shibsp/handler/impl/SessionHandler.cpp
+++ b/shibsp/handler/impl/SessionHandler.cpp
@@ -226,9 +226,8 @@ pair<bool,long> SessionHandler::doJSON(SPRequest& request) const
 pair<bool,long> SessionHandler::doHTML(SPRequest& request) const
 {
     // Default delimiter is semicolon but is configurable.
-    const char* delim = request.getAgent().getAttributeConfiguration(
-        request.getRequestSettings().first->getString(RequestMapper::ATTRIBUTE_CONFIG_ID_PROP_NAME)
-        ).getString(AttributeConfiguration::VALUE_DELIMITER_PROP_NAME, AttributeConfiguration::VALUE_DELIMITER_PROP_DEFAULT);
+    const char* delim = request.getRequestSettings().first->getString(RequestMapper::ATTRIBUTE_VALUE_DELIMITER_PROP_NAME,
+        RequestMapper::ATTRIBUTE_VALUE_DELIMITER_PROP_DEFAULT);
     size_t delim_len = strlen(delim);
 
     stringstream s;
diff --git a/shibsp/impl/XMLRequestMapper.cpp b/shibsp/impl/XMLRequestMapper.cpp
index 07b321f5..cb4bdb48 100644
--- a/shibsp/impl/XMLRequestMapper.cpp
+++ b/shibsp/impl/XMLRequestMapper.cpp
@@ -169,6 +169,7 @@ void SHIBSP_API shibsp::registerRequestMappers()
 
 const char RequestMapper::APPLICATION_ID_PROP_NAME[] =      "applicationId";
 const char RequestMapper::ATTRIBUTE_CONFIG_ID_PROP_NAME[] = "attributeConfigId";
+const char RequestMapper::ATTRIBUTE_VALUE_DELIMITER_PROP_NAME[] = "attributeValueDelimiter";
 const char RequestMapper::AUTH_TYPE_PROP_NAME[] =           "authType";
 const char RequestMapper::CONSISTENT_ADDRESS_PROP_NAME[] =  "consistentAddress";
 const char RequestMapper::COOKIE_MAXAGE_PROP_NAME[] =       "cookieMaxAge";
@@ -190,6 +191,7 @@ const char RequestMapper::USE_HEADERS_PROP_NAME[] =         "useHeaders";
 const char RequestMapper::USE_VARIABLES_PROP_NAME[] =       "useVariables";
 
 const char RequestMapper::APPLICATION_ID_PROP_DEFAULT[] =   "default";
+const char RequestMapper::ATTRIBUTE_VALUE_DELIMITER_PROP_DEFAULT[] = ";";
 bool RequestMapper::CONSISTENT_ADDRESS_PROP_DEFAULT =       true;
 bool RequestMapper::EXPIRE_REDIRECTS_PROP_DEFAULT =         true;
 unsigned int RequestMapper::LIFETIME_PROP_DEFAULT =         3600 * 8;

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


More information about the commits mailing list