[cpp-sp] branch main updated: Add more constants.

Scott Cantor cantor.2 at osu.edu
Tue Jul 22 13:57:26 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=500b797e4e5357c5b0f69f3bc7b3858fbf9f9d91

The following commit(s) were added to refs/heads/main by this push:
     new 500b797e Add more constants.
500b797e is described below

commit 500b797e4e5357c5b0f69f3bc7b3858fbf9f9d91
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Jul 22 09:57:16 2025 -0400

    Add more constants.
---
 apache/mod_shib_24.cpp                 | 18 +++++++++---------
 shibsp/RequestMapper.h                 |  3 +++
 shibsp/handler/impl/SessionHandler.cpp |  9 +++++++--
 shibsp/handler/impl/StatusHandler.cpp  |  2 +-
 shibsp/impl/XMLRequestMapper.cpp       |  2 ++
 5 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/apache/mod_shib_24.cpp b/apache/mod_shib_24.cpp
index d12d2ec9..4088b230 100644
--- a/apache/mod_shib_24.cpp
+++ b/apache/mod_shib_24.cpp
@@ -1016,12 +1016,12 @@ bool ApacheRequestMapper::hasProperty(const char* name) const
 {
     if (m_sta && name) {
         // Override Apache-settable string properties.
-        if (!strcmp(name,"authType")) {
+        if (!strcmp(name, RequestMapper::AUTH_TYPE_PROP_NAME)) {
             return ap_auth_type(m_sta->m_req) != nullptr;
         }
-        else if (!strcmp(name,"applicationId"))
+        else if (!strcmp(name, RequestMapper::APPLICATION_ID_PROP_NAME))
             return m_sta->m_dc->szApplicationId != nullptr;
-        else if (!strcmp(name,"redirectToSSL"))
+        else if (!strcmp(name, RequestMapper::REDIRECT_TO_SSL_PROP_NAME))
             return m_sta->m_dc->szRedirectToSSL != nullptr;
         else if (m_sta->m_dc->tSettings) {
             return apr_table_get(m_sta->m_dc->tSettings, name) != nullptr;
@@ -1036,7 +1036,7 @@ bool ApacheRequestMapper::getBool(const char* name, bool defaultValue) const
 {
     if (m_sta && name) {
         // Override Apache-settable boolean properties.
-        if (!strcmp(name,"requireSession") && m_sta->m_dc->bRequireSession != -1)
+        if (!strcmp(name, RequestMapper::REQUIRE_SESSION_PROP_NAME) && m_sta->m_dc->bRequireSession != -1)
             return m_sta->m_dc->bRequireSession == 1;
         else if (m_sta->m_dc->tSettings) {
             const char* prop = apr_table_get(m_sta->m_dc->tSettings, name);
@@ -1052,7 +1052,7 @@ const char* ApacheRequestMapper::getString(const char* name, const char* default
 {
     if (m_sta) {
         // Override Apache-settable string properties.
-        if (name && !strcmp(name,"authType")) {
+        if (name && !strcmp(name, RequestMapper::AUTH_TYPE_PROP_NAME)) {
             const char* auth_type = ap_auth_type(m_sta->m_req);
             if (auth_type) {
                 // Check for Basic Hijack
@@ -1061,9 +1061,9 @@ const char* ApacheRequestMapper::getString(const char* name, const char* default
                 return auth_type;
             }
         }
-        else if (name && !strcmp(name,"applicationId") && m_sta->m_dc->szApplicationId)
+        else if (name && !strcmp(name, RequestMapper::APPLICATION_ID_PROP_NAME) && m_sta->m_dc->szApplicationId)
             return m_sta->m_dc->szApplicationId;
-        else if (name && !strcmp(name,"redirectToSSL") && m_sta->m_dc->szRedirectToSSL)
+        else if (name && !strcmp(name, RequestMapper::REDIRECT_TO_SSL_PROP_NAME) && m_sta->m_dc->szRedirectToSSL)
             return m_sta->m_dc->szRedirectToSSL;
         else if (m_sta->m_dc->tSettings) {
             const char* prop = apr_table_get(m_sta->m_dc->tSettings, name);
@@ -1079,7 +1079,7 @@ unsigned int ApacheRequestMapper::getUnsignedInt(const char* name, unsigned int
 {
     if (m_sta) {
         // Override Apache-settable int properties.
-        if (name && !strcmp(name,"redirectToSSL") && m_sta->m_dc->szRedirectToSSL)
+        if (name && !strcmp(name, RequestMapper::REDIRECT_TO_SSL_PROP_NAME) && m_sta->m_dc->szRedirectToSSL)
             return atoi(m_sta->m_dc->szRedirectToSSL);
         else if (m_sta->m_dc->tSettings) {
             const char* prop = apr_table_get(m_sta->m_dc->tSettings, name);
@@ -1095,7 +1095,7 @@ int ApacheRequestMapper::getInt(const char* name, int defaultValue) const
 {
     if (m_sta) {
         // Override Apache-settable int properties.
-        if (name && !strcmp(name,"redirectToSSL") && m_sta->m_dc->szRedirectToSSL)
+        if (name && !strcmp(name, RequestMapper::REDIRECT_TO_SSL_PROP_NAME) && m_sta->m_dc->szRedirectToSSL)
             return atoi(m_sta->m_dc->szRedirectToSSL);
         else if (m_sta->m_dc->tSettings) {
             const char* prop = apr_table_get(m_sta->m_dc->tSettings, name);
diff --git a/shibsp/RequestMapper.h b/shibsp/RequestMapper.h
index 25783ba5..51639840 100644
--- a/shibsp/RequestMapper.h
+++ b/shibsp/RequestMapper.h
@@ -68,12 +68,15 @@ namespace shibsp {
         static const char CONSISTENT_ADDRESS_PROP_NAME[];
         static const char COOKIE_MAXAGE_PROP_NAME[];
         static const char SESSION_COOKIE_NAME_PROP_NAME[];
+        static const char TARGET_PROP_NAME[];
+        static const char PRESERVE_POST_DATA_PROP_NAME[];
 
         static const char APPLICATION_ID_PROP_DEFAULT[];
         static bool REQUIRE_SESSION_PROP_DEFAULT;
         static unsigned int LIFETIME_PROP_DEFAULT;
         static unsigned int TIMEOUT_PROP_DEFAULT;
         static bool CONSISTENT_ADDRESS_PROP_DEFAULT;
+        static bool PRESERVE_POST_DATA_PROP_DEFAULT;
 
         /**
          * Map request to settings.
diff --git a/shibsp/handler/impl/SessionHandler.cpp b/shibsp/handler/impl/SessionHandler.cpp
index 1a6d07d5..b11aa099 100644
--- a/shibsp/handler/impl/SessionHandler.cpp
+++ b/shibsp/handler/impl/SessionHandler.cpp
@@ -71,11 +71,16 @@ namespace shibsp {
 
 SessionHandler::SessionHandler(const ptree& pt) : SecuredHandler(pt), m_values(false)
 {
-    m_contentType = getString("contentType", "");
+    static const char CONTENT_TYPE_PROP_NAME[] = "contentType";
+    static const char SHOW_ATTRIBUTE_VALUES_PROP_NAME[] = "showAttributeValues";
+
+    static bool SHOW_ATTRIBUTE_VALUES_PROP_DEFAULT = false;
+
+    m_contentType = getString(CONTENT_TYPE_PROP_NAME, "");
     if (!m_contentType.empty() && m_contentType != "application/json" && m_contentType != "text/html")
         throw ConfigurationException("Unsupported contentType property in Session Handler configuration.");
 
-    m_values = getBool("showAttributeValues", false);
+    m_values = getBool(SHOW_ATTRIBUTE_VALUES_PROP_NAME, SHOW_ATTRIBUTE_VALUES_PROP_DEFAULT);
 }
 
 namespace {
diff --git a/shibsp/handler/impl/StatusHandler.cpp b/shibsp/handler/impl/StatusHandler.cpp
index 3483cf3e..39232e34 100644
--- a/shibsp/handler/impl/StatusHandler.cpp
+++ b/shibsp/handler/impl/StatusHandler.cpp
@@ -210,7 +210,7 @@ pair<bool,long> StatusHandler::run(SPRequest& request, bool isHandler) const
     ts << date::format("%FT%TZ", date::floor<chrono::milliseconds>(now));
     string timestamp(ts.str());
 
-    const char* target = request.getParameter("target");
+    const char* target = request.getParameter(RequestMapper::TARGET_PROP_NAME);
     if (target) {
         // RequestMap query, so handle it inproc.
         DummyRequest dummy(target);
diff --git a/shibsp/impl/XMLRequestMapper.cpp b/shibsp/impl/XMLRequestMapper.cpp
index 2fbbf211..29681ed4 100644
--- a/shibsp/impl/XMLRequestMapper.cpp
+++ b/shibsp/impl/XMLRequestMapper.cpp
@@ -181,6 +181,8 @@ const char RequestMapper::TIMEOUT_PROP_NAME[] = "timeout";
 const char RequestMapper::CONSISTENT_ADDRESS_PROP_NAME[] = "consistentAddress";
 const char RequestMapper::COOKIE_MAXAGE_PROP_NAME[] = "cookieMaxAge";
 const char RequestMapper::SESSION_COOKIE_NAME_PROP_NAME[] = "sessionCookieName";
+const char RequestMapper::TARGET_PROP_NAME[] = "target";
+const char RequestMapper::PRESERVE_POST_DATA_PROP_NAME[] = "preservePostData";
 
 const char RequestMapper::APPLICATION_ID_PROP_DEFAULT[] = "default";
 bool RequestMapper::REQUIRE_SESSION_PROP_DEFAULT = false;

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


More information about the commits mailing list