[cpp-sp] branch main updated: Agent global property constants.

Scott Cantor cantor.2 at osu.edu
Tue Jan 14 20:59:44 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=a524cbf7acb48ff935d84775db6f2da45bd7ea40

The following commit(s) were added to refs/heads/main by this push:
     new a524cbf7 Agent global property constants.
a524cbf7 is described below

commit a524cbf7acb48ff935d84775db6f2da45bd7ea40
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Jan 14 15:59:39 2025 -0500

    Agent global property constants.
---
 apache/mod_shib_24.cpp |  8 ++++----
 iis7_shib/register.cpp | 43 +++++++++++++++++--------------------------
 shibsp/Agent.cpp       |  5 +++++
 shibsp/Agent.h         | 22 ++++++++++++++--------
 4 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/apache/mod_shib_24.cpp b/apache/mod_shib_24.cpp
index 8d2c3d45..53978b02 100644
--- a/apache/mod_shib_24.cpp
+++ b/apache/mod_shib_24.cpp
@@ -1450,14 +1450,14 @@ extern "C" void shib_child_init(apr_pool_t* p, server_rec* s)
     ap_log_error(APLOG_MARK, APLOG_INFO|APLOG_NOERRNO, 0, s, "child_init: shib_module initializing in pid (%d)", (int)getpid());
 
     const Agent& agent = g_Config->getAgent();
-    g_unsetHeaderValue = agent.getString("unsetHeaderValue");
-    g_checkSpoofing = agent.getBool("checkSpoofing", true);
+    g_unsetHeaderValue = agent.getString(Agent::UNSET_HEADER_VALUE_PROP_NAME);
+    g_checkSpoofing = agent.getBool(Agent::CHECK_SPOOFING_PROP_NAME, true);
     if (g_checkSpoofing) {
-        const char* altkey = agent.getString("spoofKey");
+        const char* altkey = agent.getString(Agent::SPOOF_KEY_PROP_NAME);
         if (altkey)
             g_spoofKey = altkey;
     }
-    g_catchAll = agent.getBool("catchAll", false);
+    g_catchAll = agent.getBool(Agent::CATCH_ALL_PROP_NAME, false);
 
     // Set the cleanup handler, passing in the server_rec for logging.
     apr_pool_cleanup_register(p, s, &shib_exit, apr_pool_cleanup_null);
diff --git a/iis7_shib/register.cpp b/iis7_shib/register.cpp
index 410602d5..44050f97 100644
--- a/iis7_shib/register.cpp
+++ b/iis7_shib/register.cpp
@@ -1,22 +1,16 @@
 /**
-* Licensed to the University Corporation for Advanced Internet
-* Development, Inc. (UCAID) under one or more contributor license
-* agreements. See the NOTICE file distributed with this work for
-* additional information regarding copyright ownership.
-*
-* UCAID licenses this file to you under the Apache License,
-* Version 2.0 (the "License"); you may not use this file except
-* in compliance with the License. You may obtain a copy of the
-* License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
-* either express or implied. See the License for the specific
-* language governing permissions and limitations under the License.
-*/
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #define _CRT_RAND_S
 // https://stackoverflow.com/questions/1301277/c-boost-whats-the-cause-of-this-warning
@@ -35,11 +29,9 @@ namespace Config {
     HINSTANCE g_hinstDLL;
     AgentConfig* g_Config = nullptr;
     unique_ptr<ModuleConfig> g_ModuleConfig;
-    bool g_bNormalizeRequest = true;
-    string g_unsetHeaderValue, g_spoofKey;
+    string g_spoofKey;
     bool g_checkSpoofing = true;
     bool g_catchAll = false;
-    wstring g_authNRole(L"ShibbolethAuthN");
 }
 
 using namespace Config;
@@ -71,7 +63,7 @@ public:
 
     virtual VOID Terminate()
     {
-        Category::getInstance(SHIBSP_LOGCAT ".IISNative").info("IIS module is terminating");
+        Category::getInstance(SHIBSP_LOGCAT ".IIS").info("IIS module is terminating");
         delete this;
     }
 };
@@ -111,11 +103,11 @@ RegisterModule(
         return E_FAIL;
     }
 
-    g_checkSpoofing = agent.getBool("checkSpoofing", true(;
-    g_catchAll = agent.getBool("catchAll", true);
+    g_checkSpoofing = agent.getBool(Agent::CHECK_SPOOFING_PROP_NAME, true);
+    g_catchAll = agent.getBool(Agent::CATCH_ALL_PROP_NAME, true);
 
     if (g_checkSpoofing) {
-        g_spoofKey = agent.getString("spoofKey", "");
+        g_spoofKey = agent.getString(Agent::SPOOF_KEY_PROP_NAME, "");
         if (g_spoofKey.empty()) {
             _invalid_parameter_handler old = _set_invalid_parameter_handler(_my_invalid_parameter_handler);
             unsigned int randkey=0, randkey2=0, randkey3=0, randkey4=0;
@@ -135,7 +127,6 @@ RegisterModule(
     }
 
     HRESULT hr = pModuleInfo->SetRequestNotifications(new ShibModuleFactory(), RQ_BEGIN_REQUEST | RQ_AUTHENTICATE_REQUEST, 0);
-
     if (SUCCEEDED(hr))
         log.info("IIS module initialized");
 
diff --git a/shibsp/Agent.cpp b/shibsp/Agent.cpp
index 68c2c8b3..91f2fdca 100644
--- a/shibsp/Agent.cpp
+++ b/shibsp/Agent.cpp
@@ -47,6 +47,11 @@
 using namespace shibsp;
 using namespace std;
 
+const char Agent::UNSET_HEADER_VALUE_PROP_NAME[] = "unsetHeaderValue";
+const char Agent::CHECK_SPOOFING_PROP_NAME[] = "checkSpoofing";
+const char Agent::SPOOF_KEY_PROP_NAME[] = "spoofKey";
+const char Agent::CATCH_ALL_PROP_NAME[] = "catchAll";
+
 Agent::Agent()
 {
     m_authTypes.insert("shibboleth");
diff --git a/shibsp/Agent.h b/shibsp/Agent.h
index bc202b5d..98dce087 100644
--- a/shibsp/Agent.h
+++ b/shibsp/Agent.h
@@ -42,10 +42,10 @@ namespace shibsp {
 #endif
 
     /**
-     * Interface to a Shibboleth ServiceProvider instance.
+     * Interface to a Shibboleth Agent instance.
      * 
-     * <p>A ServiceProvider exposes configuration and infrastructure services required
-     * by the SP implementation, allowing a flexible configuration format.
+     * <p>An agent exposes configuration and infrastructure services required
+     * by the agent implementation.</p>
      */
 	class SHIBSP_API Agent : public virtual PropertySet
     {
@@ -60,7 +60,7 @@ namespace shibsp {
          * 
          * <p>Implemented as a separate method so that services can rely on
          * other services while they initialize by accessing the Agent
-         * from the AgentConfig singleton.
+         * from the AgentConfig singleton.</p>
          */
         virtual void init()=0;
 
@@ -92,7 +92,7 @@ namespace shibsp {
          * Enforces requirements for an authenticated session.
          * 
          * <p>If the return value's first member is true, then request processing should terminate
-         * with the second member as a status value. If false, processing can continue. 
+         * with the second member as a status value. If false, processing can continue.</p>
          * 
          * @param request   SP request interface
          * @param handler   true iff a request to a registered Handler location can be directly executed
@@ -104,7 +104,7 @@ namespace shibsp {
          * Enforces authorization requirements based on the authenticated session.
          * 
          * <p>If the return value's first member is true, then request processing should terminate
-         * with the second member as a status value. If false, processing can continue. 
+         * with the second member as a status value. If false, processing can continue.</p>
          * 
          * @param request   SP request interface
          * @return a pair containing a "request completed" indicator and a server-specific response code
@@ -115,7 +115,7 @@ namespace shibsp {
          * Publishes session contents to the request in the form of headers or environment variables.
          * 
          * <p>If the return value's first member is true, then request processing should terminate
-         * with the second member as a status value. If false, processing can continue. 
+         * with the second member as a status value. If false, processing can continue.</p>
          * 
          * @param request   SP request interface
          * @param requireSession    set to true iff an error should result if no session exists 
@@ -127,13 +127,19 @@ namespace shibsp {
          * Services requests for registered Handler locations. 
          * 
          * <p>If the return value's first member is true, then request processing should terminate
-         * with the second member as a status value. If false, processing can continue. 
+         * with the second member as a status value. If false, processing can continue.</p>
          * 
          * @param request   SP request interface
          * @return a pair containing a "request completed" indicator and a server-specific response code
          */
         virtual std::pair<bool,long> doHandler(SPRequest& request) const;
 
+        /** Property name constants. */
+        static const char UNSET_HEADER_VALUE_PROP_NAME[];
+        static const char CHECK_SPOOFING_PROP_NAME[];
+        static const char SPOOF_KEY_PROP_NAME[];
+        static const char CATCH_ALL_PROP_NAME[];
+
     protected:
         /** The AuthTypes to "recognize" (defaults to "shibboleth"). */
         std::set<std::string> m_authTypes;

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


More information about the commits mailing list