[cpp-sp] branch main updated: Adding constants, reverse caseSensitive setting for attributes.

Scott Cantor cantor.2 at osu.edu
Tue Jul 15 16:13:21 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=6741663817abe36eebcb9978cb6dad3bcdc44972

The following commit(s) were added to refs/heads/main by this push:
     new 67416638 Adding constants, reverse caseSensitive setting for attributes.
67416638 is described below

commit 6741663817abe36eebcb9978cb6dad3bcdc44972
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Jul 15 12:13:15 2025 -0400

    Adding constants, reverse caseSensitive setting for attributes.
---
 configs/attributes.ini                             | 11 +++----
 .../impl/DefaultAttributeConfiguration.cpp         | 36 ++++++++++++++++------
 .../remoting/impl/AbstractHTTPRemotingService.cpp  |  4 +--
 shibsp/remoting/impl/WinHTTPRemotingService.cpp    | 12 ++------
 shibsp/session/impl/AbstractSessionCache.cpp       |  6 ++++
 5 files changed, 42 insertions(+), 27 deletions(-)

diff --git a/configs/attributes.ini b/configs/attributes.ini
index 4e8c179b..2cd82b20 100644
--- a/configs/attributes.ini
+++ b/configs/attributes.ini
@@ -1,11 +1,10 @@
 [settings]
-#attributeValueDelimiter = ;
-#scopedDelimiter = @
+#scopeDelimiter = @
 #exportDuplicateValues = true
-caseSensitiveAttributes = foo, bar
-legacyClassRefAttribute = Shib-AuthnContext-Class
-legacyAuthnTimeAttribute = Shib-Authentication-Instant
-# Set to URL to apply URL encoding
+#caseSensitiveAttributes = foo bar
+#legacyClassRefAttribute = Shib-AuthnContext-Class
+#legacyAuthnTimeAttribute = Shib-Authentication-Instant
+# Set to URL to apply URL encoding on export
 #encoding =
 
 [mappings]
diff --git a/shibsp/attribute/impl/DefaultAttributeConfiguration.cpp b/shibsp/attribute/impl/DefaultAttributeConfiguration.cpp
index 658008b0..feaafc22 100644
--- a/shibsp/attribute/impl/DefaultAttributeConfiguration.cpp
+++ b/shibsp/attribute/impl/DefaultAttributeConfiguration.cpp
@@ -76,7 +76,7 @@ namespace {
         ptree m_pt;
         bool m_urlEncoding,m_exportDuplicates,m_partialRegexMatching;
         map<string,string> m_mappings;
-        set<string> m_caseSensitiveIds;
+        set<string> m_caseInsensitiveIds;
     };
 
 };
@@ -97,6 +97,17 @@ AttributeConfiguration::~AttributeConfiguration() {}
 DefaultAttributeConfiguration::DefaultAttributeConfiguration(const char* pathname)
     : m_log(Category::getInstance(SHIBSP_LOGCAT ".AttributeConfiguration")), m_urlEncoding(false), m_exportDuplicates(true)
 {
+    static const char EXPORT_DUP_VALUES_PROP_NAME[] = "exportDuplicateValues";
+    static bool EXPORT_DUP_VALUES_PROP_DEFAULT = true;
+
+    static const char CASE_INSENSITIVE_ATTRS_PROP_NAME[] = "caseInsensitiveAttributes";
+
+    static const char ENCODING_PROP_NAME[] = "encoding";
+    // Not the default, but the only defined option.
+    static const char URL_ENCODING_PROP_VALUE[] = "URL";
+
+    static const char MAPPINGS_PROP_SECTION_NAME[] = "mappings";
+
     // Populate "built-in" mappings.
     for (const string& name : {"Shib-Application-ID", "Shib-Session-ID", "Shib-Session-Expires", "Shib-Session-Inactivity", "REMOTE_USER"}) {
         m_mappings[name] = name;
@@ -109,15 +120,15 @@ DefaultAttributeConfiguration::DefaultAttributeConfiguration(const char* pathnam
     ini_parser::read_ini(pathname, m_pt);
     load(m_pt);
 
-    split_to_container(m_caseSensitiveIds, getString("caseSensitiveAttributes", ""));
+    split_to_container(m_caseInsensitiveIds, getString(CASE_INSENSITIVE_ATTRS_PROP_NAME, ""));
 
-    m_urlEncoding = !strcmp(getString("encoding", ""), "URL");
-    m_exportDuplicates = getBool("exportDuplicateValues", true);
+    m_urlEncoding = !strcmp(getString(ENCODING_PROP_NAME, ""), URL_ENCODING_PROP_VALUE);
+    m_exportDuplicates = getBool(EXPORT_DUP_VALUES_PROP_NAME, EXPORT_DUP_VALUES_PROP_DEFAULT);
 
     m_partialRegexMatching = AgentConfig::getConfig().getAgent().getBool(
         Agent::PARTIAL_REGEX_MATCHING_PROP_NAME, Agent::PARTIAL_REGEX_MATCHING_PROP_DEFAULT);
 
-    boost::optional<ptree&> mappings = m_pt.get_child_optional("mappings");
+    boost::optional<ptree&> mappings = m_pt.get_child_optional(MAPPINGS_PROP_SECTION_NAME);
     if (!mappings) {
         return;
     }
@@ -141,6 +152,11 @@ unique_ptr<AttributeConfiguration> AttributeConfiguration::newAttributeConfigura
 
 bool DefaultAttributeConfiguration::processAttributes(DDF& attributes) const
 {
+    const char SCOPE_DELIMITER_PROP_NAME[] = "scopeDelimiter";
+    const char SCOPE_DELIMITER_PROP_DEFAULT[] = "@";
+
+    const char* scopeDelimiter = getString(SCOPE_DELIMITER_PROP_NAME, SCOPE_DELIMITER_PROP_DEFAULT);
+
     if (!attributes.islist()) {
         m_log.warn("invalid data supplied for session attributes");
         return false;
@@ -169,7 +185,7 @@ bool DefaultAttributeConfiguration::processAttributes(DDF& attributes) const
                     const char* lhs = value.getmember("value").string();
                     const char* scope = value.getmember("scope").string();
                     if (lhs && scope && *lhs && *scope) {
-                        string s = string(lhs) + getString("scopeDelimiter", "@") + scope;
+                        string s = string(lhs) + scopeDelimiter + scope;
                         value.string(s.c_str());
                     } else {
                         value.destroy();
@@ -220,9 +236,9 @@ bool DefaultAttributeConfiguration::processAttributes(DDF& attributes) const
 bool DefaultAttributeConfiguration::isCaseSensitive(const char* attributeID) const
 {
     if (!attributeID) {
-        return false;
+        return true;
     }
-    return m_caseSensitiveIds.count(attributeID) > 0;
+    return m_caseInsensitiveIds.count(attributeID) == 0;
 }
 
 void DefaultAttributeConfiguration::clearHeaders(SPRequest& request) const
@@ -365,7 +381,7 @@ bool DefaultAttributeConfiguration::hasMatchingValue(
         return false;
     }
 
-    bool caseSensitive = m_caseSensitiveIds.count(attributeId) > 0;
+    bool caseSensitive = isCaseSensitive(attributeId);
 
     DDF val = const_cast<DDF&>(attr->second).first();
     while (!val.isnull()) {
@@ -398,7 +414,7 @@ bool DefaultAttributeConfiguration::hasMatchingValue(
         return false;
     }
 
-    bool caseSensitive = m_caseSensitiveIds.count(attributeId) > 0;
+    bool caseSensitive = isCaseSensitive(attributeId);
 
     DDF val = const_cast<DDF&>(attr->second).first();
     while (!val.isnull()) {
diff --git a/shibsp/remoting/impl/AbstractHTTPRemotingService.cpp b/shibsp/remoting/impl/AbstractHTTPRemotingService.cpp
index 5528e118..1b28862c 100644
--- a/shibsp/remoting/impl/AbstractHTTPRemotingService.cpp
+++ b/shibsp/remoting/impl/AbstractHTTPRemotingService.cpp
@@ -46,14 +46,14 @@ const char AbstractHTTPRemotingService::TIMEOUT_PROP_NAME[] = "timeout";
 const char AbstractHTTPRemotingService::CA_FILE_PROP_NAME[] = "tlsCAFile";
 const char AbstractHTTPRemotingService::REVOCATION_CHECK_PROP_NAME[] = "revocationCheck";
 
-const char AbstractHTTPRemotingService::SECRET_SOURCE_TYPE_PROP_DEFAULT[] = "File";
+const char AbstractHTTPRemotingService::SECRET_SOURCE_TYPE_PROP_DEFAULT[] = FILE_SECRET_SOURCE;
 const char AbstractHTTPRemotingService::BASE_URL_PROP_DEFAULT[] = "http://localhost/idp/profile/sp";
 const char AbstractHTTPRemotingService::AUTH_METHOD_PROP_DEFAULT[] = "basic";
 const char AbstractHTTPRemotingService::AUTH_CACHING_COOKIE_PROP_DEFAULT[] = "__Host-JSESSIONID";
 unsigned int AbstractHTTPRemotingService::CONNECT_TIMEOUT_PROP_DEFAULT = 3;
 unsigned int AbstractHTTPRemotingService::TIMEOUT_PROP_DEFAULT = 10;
-const bool AbstractHTTPRemotingService::REVOCATION_CHECK_DEFAULT = false;
 const char AbstractHTTPRemotingService::CA_FILE_PROP_DEFAULT[] = "trustlist.pem";
+const bool AbstractHTTPRemotingService::REVOCATION_CHECK_DEFAULT = false;
 
 AbstractHTTPRemotingService::AbstractHTTPRemotingService(ptree& pt)
     : AbstractRemotingService(pt), m_authMethod(agent_auth_none)
diff --git a/shibsp/remoting/impl/WinHTTPRemotingService.cpp b/shibsp/remoting/impl/WinHTTPRemotingService.cpp
index 867cd1da..52286dd0 100644
--- a/shibsp/remoting/impl/WinHTTPRemotingService.cpp
+++ b/shibsp/remoting/impl/WinHTTPRemotingService.cpp
@@ -59,10 +59,6 @@ namespace {
             return m_log;
         }
 
-        Category& winHTTP_logger() const {
-            return m_winHTTPlog;
-        }
-
         bool isChunked() const {
             return m_chunked;
         }
@@ -77,7 +73,6 @@ namespace {
 
     private:
         Category& m_log;
-        Category& m_winHTTPlog;
         bool m_init;
         HINTERNET m_session;
         HINTERNET m_connection;
@@ -229,8 +224,7 @@ StatusCallback(
 
 WinHTTPRemotingService::WinHTTPRemotingService(ptree& pt)
     : AbstractHTTPRemotingService(pt), AbstractRemotingService(pt),
-    m_log(Category::getInstance(SHIBSP_LOGCAT ".RemotingService.WinHTTP")),
-    m_winHTTPlog(Category::getInstance(SHIBSP_LOGCAT ".winHTTP")),
+    m_log(Category::getInstance(SHIBSP_LOGCAT ".RemotingService")),
     m_secure(false), m_caChainEngine(nullptr), m_caStore(nullptr),
     m_init(false), m_chunked(defaultChunking)
 {
@@ -239,14 +233,14 @@ WinHTTPRemotingService::WinHTTPRemotingService(ptree& pt)
         setUserAgent(useragent.c_str());
     }
 
-    static const char CIPHER_LIST_PROP_NAME[] = "tlsCipherList";
+    //static const char CIPHER_LIST_PROP_NAME[] = "tlsCipherList";
     static const char CHUNKED_PROP_NAME[] = "chunkedEncoding";
     
     BoostPropertySet props;
     props.load(pt);
 
     m_chunked = props.getBool(CHUNKED_PROP_NAME, defaultChunking);
-    m_ciphers = props.getString(CIPHER_LIST_PROP_NAME, "");
+    //m_ciphers = props.getString(CIPHER_LIST_PROP_NAME, "");
     m_username = utf8ToUtf16(AgentConfig::getConfig().getAgent().getID());
     switch (getAuthMethod()) {
         case agent_auth_basic:  m_authScheme = WINHTTP_AUTH_SCHEME_BASIC; break;
diff --git a/shibsp/session/impl/AbstractSessionCache.cpp b/shibsp/session/impl/AbstractSessionCache.cpp
index 38203bb9..13acf3e2 100644
--- a/shibsp/session/impl/AbstractSessionCache.cpp
+++ b/shibsp/session/impl/AbstractSessionCache.cpp
@@ -514,7 +514,13 @@ void* AbstractSessionCache::cleanup_fn(void* p)
 
     // Load our configuration details...
     unsigned int cleanupInterval = pcache->getUnsignedInt(CLEANUP_INTERVAL_PROP_NAME, CLEANUP_INTERVAL_PROP_DEFAULT);
+    if (cleanupInterval == 0) {
+        cleanupInterval = CLEANUP_INTERVAL_PROP_DEFAULT;
+    }
     unsigned int inprocTimeout = pcache->getUnsignedInt(INPROC_TIMEOUT_PROP_NAME, INPROC_TIMEOUT_PROP_DEFAULT);
+    if (inprocTimeout == 0) {
+        inprocTimeout = INPROC_TIMEOUT_PROP_DEFAULT;
+    }
 
     mutex internal_mutex;
     unique_lock lock(internal_mutex);

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


More information about the commits mailing list