[cpp-sp] branch main updated: CPPSP-43 - Implement transaction ID for help in log correlation

Codeberg noreply at shibboleth.net
Wed Jan 28 18:32:38 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/468066bd21a8d6dcee813abb99cd58f4e89158a5

The following commit(s) were added to refs/heads/main by this push:
     new 468066bd CPPSP-43 - Implement transaction ID for help in log correlation
468066bd is described below

commit 468066bd21a8d6dcee813abb99cd58f4e89158a5
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Jan 28 13:31:46 2026 -0500

    CPPSP-43 - Implement transaction ID for help in log correlation
    
    https://shibboleth.atlassian.net/browse/CPPSP-43
    
    Added helpers for remoter input construction.
    Added request ID to SPRequest interface to use as an ID.
    Added random number generation to AgentConfig interface.
---
 apache/mod_shib4.cpp                               |  3 ++
 fastcgi/shibauthorizer.cpp                         |  6 +++-
 fastcgi/shibresponder.cpp                          |  7 +++--
 iis/IIS7Request.cpp                                |  7 +++++
 iis/headers/IIS7Request.hpp                        | 32 ++++++++--------------
 shibsp/AgentConfig.h                               | 12 ++++++++
 shibsp/SPRequest.h                                 |  6 ++++
 shibsp/handler/impl/Passthrough.cpp                |  6 +---
 shibsp/handler/impl/SessionInitiator.cpp           |  6 +---
 shibsp/handler/impl/StatusHandler.cpp              |  2 +-
 shibsp/handler/impl/TokenConsumer.cpp              |  6 +---
 shibsp/impl/AgentConfig.cpp                        |  8 ++++++
 shibsp/remoting/RemotingService.h                  | 25 +++++++++++++++++
 shibsp/remoting/impl/AbstractRemotingService.cpp   | 17 ++++++++++++
 shibsp/remoting/impl/AbstractRemotingService.h     |  7 +----
 shibsp/remoting/impl/RemotingService.cpp           | 13 +++++++++
 shibsp/session/impl/FilesystemSessionCache.cpp     |  6 ++--
 shibsp/session/impl/MemorySessionCache.cpp         |  5 ++--
 shibsp/session/impl/StorageServiceSessionCache.cpp | 28 +++++++++++--------
 tests/DummyRequest.h                               |  1 +
 20 files changed, 139 insertions(+), 64 deletions(-)

diff --git a/apache/mod_shib4.cpp b/apache/mod_shib4.cpp
index b7b19d9a..ef546823 100644
--- a/apache/mod_shib4.cpp
+++ b/apache/mod_shib4.cpp
@@ -292,6 +292,9 @@ public:
     }
     return true;
   }
+  const char* getRequestID() const {
+    return m_req->log_id;
+  }
   const char* getScheme() const {
     return ap_http_scheme(m_req);
   }
diff --git a/fastcgi/shibauthorizer.cpp b/fastcgi/shibauthorizer.cpp
index ee64d5c1..2bad8b68 100644
--- a/fastcgi/shibauthorizer.cpp
+++ b/fastcgi/shibauthorizer.cpp
@@ -48,6 +48,7 @@ typedef enum {
 class ShibTargetFCGIAuth : public AbstractSPRequest
 {
     FCGX_Request* m_req;
+    string m_id;
     int m_port;
     string m_scheme,m_hostname;
     multimap<string,string> m_response_headers;
@@ -55,7 +56,7 @@ public:
     map<string,string> m_request_headers;
 
     ShibTargetFCGIAuth(FCGX_Request* req, const char* scheme=nullptr, const char* hostname=nullptr, int port=0)
-            : AbstractSPRequest(SHIBSP_LOGCAT ".FastCGI"), m_req(req) {
+            : AbstractSPRequest(SHIBSP_LOGCAT ".FastCGI"), m_req(req), m_id(AgentConfig::getConfig().generateRandom(8)) {
         const char* server_name_str = hostname;
         if (!server_name_str || !*server_name_str)
             server_name_str = FCGX_GetParam("SERVER_NAME", req->envp);
@@ -81,6 +82,9 @@ public:
 
     ~ShibTargetFCGIAuth() { }
 
+    const char* getRequestID() const {
+        return m_id.c_str();
+    }
     bool isUseHeaders() const {
         return false;
     }
diff --git a/fastcgi/shibresponder.cpp b/fastcgi/shibresponder.cpp
index 012a73e0..81306421 100644
--- a/fastcgi/shibresponder.cpp
+++ b/fastcgi/shibresponder.cpp
@@ -51,11 +51,11 @@ class ShibTargetFCGI : public AbstractSPRequest
     const char* m_body;
     multimap<string,string> m_response_headers;
     int m_port;
-    string m_scheme,m_hostname;
+    string m_scheme,m_hostname,m_id;
 
 public:
     ShibTargetFCGI(FCGX_Request* req, char* post_data, const char* scheme=nullptr, const char* hostname=nullptr, int port=0)
-        : AbstractSPRequest(SHIBSP_LOGCAT ".FastCGI"), m_req(req), m_body(post_data) {
+        : AbstractSPRequest(SHIBSP_LOGCAT ".FastCGI"), m_req(req), m_body(post_data), m_id(AgentConfig::getConfig().generateRandom(8)) {
 
         const char* server_name_str = hostname;
         if (!server_name_str || !*server_name_str)
@@ -82,6 +82,9 @@ public:
 
     ~ShibTargetFCGI() { }
 
+    const char* getRequestID() const {
+        return m_id.c_str();
+    }
     bool isUseHeaders() const {
         return false;
     }
diff --git a/iis/IIS7Request.cpp b/iis/IIS7Request.cpp
index 7063c62c..f753c089 100644
--- a/iis/IIS7Request.cpp
+++ b/iis/IIS7Request.cpp
@@ -155,6 +155,13 @@ IIS7Request::IIS7Request(IHttpContext *pHttpContext, IHttpEventProvider *pEventP
     }
 }
 
+const char* IIS7Request::getRequestID() const
+{
+    // TODO: Use AgentConfig generateRandom if IIS has nothing to use, would store
+    // off in string member and just return that here.
+    return nullptr;
+}
+
 bool IIS7Request::isUseHeaders() const
 {
     return m_useHeaders;
diff --git a/iis/headers/IIS7Request.hpp b/iis/headers/IIS7Request.hpp
index 161cf5e9..c82bd230 100644
--- a/iis/headers/IIS7Request.hpp
+++ b/iis/headers/IIS7Request.hpp
@@ -48,9 +48,18 @@ public:
     bool isUseHeaders() { return m_useHeaders; }
 
 protected:
-    //
-    // AbstractSP
-    //
+    const char* getRequestID() const;
+    const char* getScheme() const;
+    const char* getHostname() const;
+    int getPort() const;
+    string getContentType() const;
+    long getContentLength() const;
+    string getRemoteUser() const;
+    string getAuthType() const;
+    const char* getRequestBody() const;
+    const char* getQueryString() const;
+    string getHeader(const char* name) const;
+
     bool isUseHeaders() const;
     bool isUseVariables() const;
     void setHeader(const char* name, const char* value);
@@ -63,24 +72,7 @@ protected:
     string getRemoteAddr() const;
     string getLocalAddr() const;
     string getSecureHeader(const char* name) const;
-    //
-    // XMLTooling::GenericRequest
-    //
-    const char* getScheme() const;
-    const char* getHostname() const;
-    int getPort() const;
-    string getContentType() const;
-    long getContentLength() const;
-    string getRemoteUser() const;
-    string getAuthType() const;
-    const char* getRequestBody() const;
-    //
-    // XMLTooing:: HTTPRequest
-    //
-    const char* getQueryString() const;
-    string getHeader(const char* name) const;
 
-    // XMLTooing:: HTTPResponse, GenericResponse
     long sendResponse(istream& in, long status);
     void setResponseHeader(const char* name, const char* value, bool replace=false);
     long sendRedirect(const char* url);
diff --git a/shibsp/AgentConfig.h b/shibsp/AgentConfig.h
index db96cc9d..28e91886 100644
--- a/shibsp/AgentConfig.h
+++ b/shibsp/AgentConfig.h
@@ -205,6 +205,18 @@ namespace shibsp {
          */
         virtual Agent& getAgent() const=0;
 
+        /**
+         * Generates a random string of designated length encoded into hex.
+         * 
+         * <p>The implementation should be reasonably secure, i.e., suitable for generating
+         * session IDs.</p>
+         * 
+         * @param len length of data in bytes to generate before encoding
+         * 
+         * @return hex encoded random data
+         */
+        virtual std::string generateRandom(unsigned int len) const=0;
+
         /**
          * Helper for deprecation warnings about an at-risk feature or setting.
          */
diff --git a/shibsp/SPRequest.h b/shibsp/SPRequest.h
index 53857e50..1f45c41c 100644
--- a/shibsp/SPRequest.h
+++ b/shibsp/SPRequest.h
@@ -51,6 +51,12 @@ namespace shibsp {
     public:
         virtual ~SPRequest();
 
+        /**
+         * Gets an optional identifier nominally unique to this request to use in
+         * logging/debugging for correlation.
+         */
+        virtual const char* getRequestID() const=0;
+
         /**
          * Returns the Agent processing the request.
          *
diff --git a/shibsp/handler/impl/Passthrough.cpp b/shibsp/handler/impl/Passthrough.cpp
index 3112903f..b7d3fd4e 100644
--- a/shibsp/handler/impl/Passthrough.cpp
+++ b/shibsp/handler/impl/Passthrough.cpp
@@ -87,12 +87,8 @@ Passthrough::Passthrough(const ptree& pt, const char* path)
 pair<bool,long> Passthrough::run(SPRequest& request, bool isHandler) const
 {
     try {
-        DDF input(m_operation.c_str());
+        DDF input = request.getAgent().getRemotingService()->build(m_operation.c_str(), request);
         DDFJanitor inputJanitor(input);
-        input.structure();
-        input.addmember("application").string(
-            request.getRequestSettings().first->getString(
-                RequestMapper::APPLICATION_ID_PROP_NAME, RequestMapper::APPLICATION_ID_PROP_DEFAULT));
 
         DDF wrapped = wrapRequest(request, m_remotedHeaders, m_body);
         input.add(wrapped);
diff --git a/shibsp/handler/impl/SessionInitiator.cpp b/shibsp/handler/impl/SessionInitiator.cpp
index 722cfb48..0481e50c 100644
--- a/shibsp/handler/impl/SessionInitiator.cpp
+++ b/shibsp/handler/impl/SessionInitiator.cpp
@@ -154,12 +154,8 @@ pair<bool,long> SessionInitiator::run(SPRequest& request, bool isHandler) const
 
         const PropertySet* settings = request.getRequestSettings().first;
 
-        DDF input("session-initiator");
+        DDF input = request.getAgent().getRemotingService()->build("session-initiator", request);
         DDFJanitor inputJanitor(input);
-
-        input.structure();
-        input.addmember("application").string(settings->getString(
-            RequestMapper::APPLICATION_ID_PROP_NAME, RequestMapper::APPLICATION_ID_PROP_DEFAULT));
         
         // Will be set unless discovery was already attempted.
         if (m_discoveryEnabled && !handler.empty()) {
diff --git a/shibsp/handler/impl/StatusHandler.cpp b/shibsp/handler/impl/StatusHandler.cpp
index 5a8af069..f3cd8ed2 100644
--- a/shibsp/handler/impl/StatusHandler.cpp
+++ b/shibsp/handler/impl/StatusHandler.cpp
@@ -259,7 +259,7 @@ pair<bool,long> StatusHandler::run(SPRequest& request, bool isHandler) const
 
         const RemotingService* remoter = request.getAgent().getRemotingService(false);
         if (remoter) {
-            DDF in("ping");
+            DDF in = remoter->build("ping", request);
             DDFJanitor jan(in);
             DDF out = remoter->send(in);
             out.destroy();
diff --git a/shibsp/handler/impl/TokenConsumer.cpp b/shibsp/handler/impl/TokenConsumer.cpp
index f708f83c..27da2f3b 100644
--- a/shibsp/handler/impl/TokenConsumer.cpp
+++ b/shibsp/handler/impl/TokenConsumer.cpp
@@ -100,12 +100,8 @@ pair<bool,long> TokenConsumer::run(SPRequest& request, bool isHandler) const
     // Not a hook response, so process as a token-consumer operation.
 
     try {
-        DDF input("token-consumer");
+        DDF input = request.getAgent().getRemotingService()->build("token-consumer", request);
         DDFJanitor inputJanitor(input);    
-        input.structure();
-        input.addmember("application").string(
-            request.getRequestSettings().first->getString(
-                RequestMapper::APPLICATION_ID_PROP_NAME, RequestMapper::APPLICATION_ID_PROP_DEFAULT));
 
         DDF wrapped = wrapRequest(request, m_remotedHeaders);
         input.add(wrapped);
diff --git a/shibsp/impl/AgentConfig.cpp b/shibsp/impl/AgentConfig.cpp
index ff5a9649..8389c871 100644
--- a/shibsp/impl/AgentConfig.cpp
+++ b/shibsp/impl/AgentConfig.cpp
@@ -26,6 +26,7 @@
 #include "Agent.h"
 #include "AgentConfig.h"
 #include "RequestMapper.h"
+#include "csprng/csprng.hpp"
 #include "handler/Handler.h"
 #include "io/HTTPResponse.h"
 #include "logging/LoggingService.h"
@@ -86,6 +87,7 @@ namespace shibsp {
 
         LoggingService& getLoggingService() const;
         Agent& getAgent() const;
+        string generateRandom(unsigned int len) const;
 
     private:
         bool _init(const char* inst_prefix=nullptr, const char* config_file=nullptr, bool rethrow=false);
@@ -106,6 +108,7 @@ namespace shibsp {
         vector<void*> m_libhandles;
         unique_ptr<LoggingService> m_logging;
         unique_ptr<Agent> m_agent;
+        mutable duthomhas::csprng m_rng;
     };
     
     static AgentInternalConfig g_agentConfig;
@@ -161,6 +164,11 @@ Agent& AgentInternalConfig::getAgent() const
     throw logic_error("Agent not initialized.");
 }
 
+string AgentInternalConfig::generateRandom(unsigned int len) const
+{
+    return hex_encode(m_rng(string(len, 0)));
+}
+
 bool AgentInternalConfig::init(const char* inst_prefix, const char* config_file, bool rethrow)
 {
     lock_guard<mutex> locker(m_lock);
diff --git a/shibsp/remoting/RemotingService.h b/shibsp/remoting/RemotingService.h
index 22853253..d8eae807 100644
--- a/shibsp/remoting/RemotingService.h
+++ b/shibsp/remoting/RemotingService.h
@@ -25,6 +25,8 @@
 
 namespace shibsp {
 
+    class SHIBSP_API SPRequest;
+
     /**
      * Interface to a remoting service.
      *
@@ -40,6 +42,29 @@ namespace shibsp {
     public:
         virtual ~RemotingService();
 
+        /**
+         * Builds a DDF to invoke a remote operation suitable to pass to
+         * the send method.
+         * 
+         * <p>The caller owns the resulting object and it is guaranteed to be a structure.</p>
+         * 
+         * @param opname name of operation
+         * @param application optional application ID to include
+         * @param txid optional transaction identifier to include for debugging
+         */
+        virtual DDF build(const char* opname, const char* application=nullptr, const char* txid=nullptr) const=0;
+
+        /**
+         * Builds a DDF to invoke a remote operation suitable to pass to
+         * the send method.
+         * 
+         * <p>The caller owns the resulting object and it is guaranteed to be a structure.</p>
+         * 
+         * @param opname name of operation
+         * @param request active request from which to obtain information to include in call
+         */
+        virtual DDF build(const char* opname, const SPRequest& request) const;
+
         /**
          * Send a remoted message and return the response.
          * 
diff --git a/shibsp/remoting/impl/AbstractRemotingService.cpp b/shibsp/remoting/impl/AbstractRemotingService.cpp
index 34db0942..8d9a9634 100644
--- a/shibsp/remoting/impl/AbstractRemotingService.cpp
+++ b/shibsp/remoting/impl/AbstractRemotingService.cpp
@@ -20,7 +20,9 @@
 
 #include "internal.h"
 #include "exceptions.h"
+#include "AgentConfig.h"
 #include "remoting/impl/AbstractRemotingService.h"
+#include "util/Misc.h"
 
 #include <sstream>
 #include <boost/property_tree/ptree.hpp>
@@ -33,6 +35,21 @@ AbstractRemotingService::AbstractRemotingService(const ptree&) {}
 
 AbstractRemotingService::~AbstractRemotingService() {}
 
+DDF AbstractRemotingService::build(const char* opname, const char* application, const char* txid) const
+{
+    DDF msg = DDF(opname).structure();
+    if (application) {
+        msg.addmember("application").string(application);
+    }
+    if (txid) {
+        msg.addmember("txid").string(txid);
+    }
+    else {
+        msg.addmember("txid").string(AgentConfig::getConfig().generateRandom(8));
+    }
+    return msg;
+}
+
 DDF AbstractRemotingService::send(const DDF& in, bool checkEvent) const
 {
     stringstream instream;
diff --git a/shibsp/remoting/impl/AbstractRemotingService.h b/shibsp/remoting/impl/AbstractRemotingService.h
index 9a911cb8..74a44cd2 100644
--- a/shibsp/remoting/impl/AbstractRemotingService.h
+++ b/shibsp/remoting/impl/AbstractRemotingService.h
@@ -37,12 +37,7 @@ namespace shibsp {
     public:
         virtual ~AbstractRemotingService();
 
-        /**
-         * Send a remoted message and return the response.
-         *
-         * @param in    input message to send
-         * @return      response from remote service
-         */
+        DDF build(const char* opname, const char* application=nullptr, const char* txid= nullptr) const;
         DDF send(const DDF& in, bool checkEvent=true) const;
 
     protected:
diff --git a/shibsp/remoting/impl/RemotingService.cpp b/shibsp/remoting/impl/RemotingService.cpp
index 3289ae86..64f4b0e8 100644
--- a/shibsp/remoting/impl/RemotingService.cpp
+++ b/shibsp/remoting/impl/RemotingService.cpp
@@ -21,8 +21,11 @@
 #include "internal.h"
 
 #include "AgentConfig.h"
+#include "SPRequest.h"
+#include "RequestMapper.h"
 #include "remoting/RemotingService.h"
 #include "remoting/SecretSource.h"
+#include "util/PropertySet.h"
 
 using namespace shibsp;
 using namespace boost::property_tree;
@@ -48,3 +51,13 @@ void SHIBSP_API shibsp::registerRemotingServices()
 RemotingService::RemotingService() {}
 
 RemotingService::~RemotingService() {}
+
+DDF RemotingService::build(const char* opname, const SPRequest& request) const
+{
+    // Extracts call metadata from request.
+    return build(
+        opname,
+        request.getRequestSettings().first->getString(
+            RequestMapper::APPLICATION_ID_PROP_NAME, RequestMapper::APPLICATION_ID_PROP_DEFAULT),
+        request.getRequestID());
+}
diff --git a/shibsp/session/impl/FilesystemSessionCache.cpp b/shibsp/session/impl/FilesystemSessionCache.cpp
index 2e4e3294..676732f4 100644
--- a/shibsp/session/impl/FilesystemSessionCache.cpp
+++ b/shibsp/session/impl/FilesystemSessionCache.cpp
@@ -22,7 +22,6 @@
 #include "exceptions.h"
 #include "AgentConfig.h"
 #include "SPRequest.h"
-#include "csprng/csprng.hpp"
 #include "session/AbstractSessionCache.h"
 #include "logging/Category.h"
 #include "util/Date.h"
@@ -82,7 +81,6 @@ namespace {
 
         Category& m_spilog;
         string m_dir;
-        duthomhas::csprng m_rng;
         time_t m_cleanupInterval;
         unsigned int m_fileTimeout;
         condition_variable m_file_cleanup_wait;
@@ -122,7 +120,7 @@ FilesystemSessionCache::FilesystemSessionCache(const ptree& pt)
         m_dir += '/';
     }
 
-    string testPath = m_dir + hex_encode(m_rng(string(16,0)));
+    string testPath = m_dir + AgentConfig::getConfig().generateRandom(16);
 
     bool failed = true;
 
@@ -204,7 +202,7 @@ string FilesystemSessionCache::cache_create(SPRequest* request, DDF& sessionData
     string path;
     int attempts = 0;
     do {
-        key = hex_encode(m_rng(string(16,0)));
+        key = AgentConfig::getConfig().generateRandom(16);
         path = m_dir + key;
         computeVersionedFilename(path, 1);
         // We attempt an exclusive open to "reserve" the new session file name.
diff --git a/shibsp/session/impl/MemorySessionCache.cpp b/shibsp/session/impl/MemorySessionCache.cpp
index c02e3a28..264d16d6 100644
--- a/shibsp/session/impl/MemorySessionCache.cpp
+++ b/shibsp/session/impl/MemorySessionCache.cpp
@@ -24,7 +24,7 @@
 
 #include "internal.h"
 #include "exceptions.h"
-#include "csprng/csprng.hpp"
+#include "AgentConfig.h"
 #include "session/AbstractSessionCache.h"
 #include "logging/Category.h"
 #include "util/Date.h"
@@ -72,7 +72,6 @@ namespace {
         static void* memory_cleanup_fn(void*);
 
         Category& m_spilog;
-        duthomhas::csprng m_rng;
         mutex m_lock;
         map<string,pair<DDF,time_t>> m_storage;
 
@@ -150,7 +149,7 @@ string MemorySessionCache::cache_create(SPRequest* request, DDF& sessionData)
 
     int attempts = 0;
     do {
-        string key = hex_encode(m_rng(string(16,0)));
+        string key = AgentConfig::getConfig().generateRandom(16);
         if (m_storage.find(key) == m_storage.end()) {
             m_storage[key] = make_pair(sessionData.copy(), time(nullptr));
             return key;
diff --git a/shibsp/session/impl/StorageServiceSessionCache.cpp b/shibsp/session/impl/StorageServiceSessionCache.cpp
index c8da4a47..fb579b46 100644
--- a/shibsp/session/impl/StorageServiceSessionCache.cpp
+++ b/shibsp/session/impl/StorageServiceSessionCache.cpp
@@ -27,7 +27,7 @@
 #include "exceptions.h"
 #include "Agent.h"
 #include "AgentConfig.h"
-#include "csprng/csprng.hpp"
+#include "SPRequest.h"
 #include "remoting/RemotingService.h"
 #include "session/AbstractSessionCache.h"
 #include "logging/Category.h"
@@ -62,7 +62,6 @@ namespace {
     
     private:
         Category& m_spilog;
-        duthomhas::csprng m_rng;
         unsigned int m_storageTimeout;
     };
 
@@ -95,7 +94,8 @@ StorageServiceSessionCache::~StorageServiceSessionCache()
 
 string StorageServiceSessionCache::cache_create(SPRequest* request, DDF& sessionData)
 {
-    DDF in = DDF("session-cache").structure();
+    const RemotingService* remoting = AgentConfig::getConfig().getAgent().getRemotingService();
+    DDF in = remoting->build("session-cache", nullptr, request ? request->getRequestID() : nullptr);
     DDFJanitor injanitor(in);
     DDF sessionCopy = sessionData.copy();
     in.add(sessionCopy.name("session"));
@@ -104,7 +104,7 @@ string StorageServiceSessionCache::cache_create(SPRequest* request, DDF& session
     in.addmember("storage_timeout").longinteger(m_storageTimeout);
 
     try {
-        DDF out = AgentConfig::getConfig().getAgent().getRemotingService()->send(in);
+        DDF out = remoting->send(in);
         DDFJanitor outJanitor(out);
         const char* key = out["key"].string();
         if (!key || !*key) {
@@ -129,7 +129,8 @@ DDF StorageServiceSessionCache::cache_read(
     const char* client_addr
     )
 {
-    DDF in = DDF("session-cache").structure();
+    const RemotingService* remoting = AgentConfig::getConfig().getAgent().getRemotingService();
+    DDF in = remoting->build("session-cache", nullptr, request ? request->getRequestID() : nullptr);
     DDFJanitor injanitor(in);
 
     in.addmember("op").string("R");
@@ -143,7 +144,7 @@ DDF StorageServiceSessionCache::cache_read(
 
     DDF out;
     try {
-        out = AgentConfig::getConfig().getAgent().getRemotingService()->send(in);
+        out = remoting->send(in);
     }
     catch (const OperationException& e) {
         // Check for policy events.
@@ -238,7 +239,8 @@ DDF StorageServiceSessionCache::cache_read(
 
 bool StorageServiceSessionCache::cache_update(SPRequest* request, const char* key, unsigned int version, DDF& sessionData)
 {
-    DDF in = DDF("session-cache").structure();
+    const RemotingService* remoting = AgentConfig::getConfig().getAgent().getRemotingService();
+    DDF in = remoting->build("session-cache", nullptr, request ? request->getRequestID() : nullptr);
     DDFJanitor injanitor(in);
 
     DDF sessionCopy = sessionData.copy();
@@ -251,7 +253,7 @@ bool StorageServiceSessionCache::cache_update(SPRequest* request, const char* ke
 
     DDF out;
     try {
-        out = AgentConfig::getConfig().getAgent().getRemotingService()->send(in);
+        out = remoting->send(in);
     }
     catch (const OperationException& e) {
         // Check for VersionMismatch event.
@@ -286,7 +288,8 @@ bool StorageServiceSessionCache::cache_update(SPRequest* request, const char* ke
 
 bool StorageServiceSessionCache::cache_touch(SPRequest* request, const char* key, unsigned int version, unsigned int timeout)
 {
-    DDF in = DDF("session-cache").structure();
+    const RemotingService* remoting = AgentConfig::getConfig().getAgent().getRemotingService();
+    DDF in = remoting->build("session-cache", nullptr, request ? request->getRequestID() : nullptr);
     DDFJanitor injanitor(in);
     in.addmember("op").string("T");
     in.addmember("key").string(key);
@@ -299,7 +302,7 @@ bool StorageServiceSessionCache::cache_touch(SPRequest* request, const char* key
 
     DDF out;
     try {
-        out = AgentConfig::getConfig().getAgent().getRemotingService()->send(in);
+        out = remoting->send(in);
     }
     catch (const OperationException& e) {
         // Check for policy events.
@@ -336,14 +339,15 @@ bool StorageServiceSessionCache::cache_touch(SPRequest* request, const char* key
 
 void StorageServiceSessionCache::cache_remove(SPRequest* request, const char* key)
 {
-    DDF in = DDF("session-cache").structure();
+    const RemotingService* remoting = AgentConfig::getConfig().getAgent().getRemotingService();
+    DDF in = remoting->build("session-cache", nullptr, request ? request->getRequestID() : nullptr);
     DDFJanitor injanitor(in);
 
     in.addmember("op").string("D");
     in.addmember("key").string(key);
 
     try {
-        DDF out = AgentConfig::getConfig().getAgent().getRemotingService()->send(in);
+        DDF out = remoting->send(in);
         out.destroy();
         log(DEBUG_MARK, "removed session from storage via Hub (%s)", key);
     }
diff --git a/tests/DummyRequest.h b/tests/DummyRequest.h
index 86cfe441..bc0773c7 100644
--- a/tests/DummyRequest.h
+++ b/tests/DummyRequest.h
@@ -30,6 +30,7 @@ namespace shibsp {
         DummyRequest(const char* uri=nullptr) : AbstractSPRequest(SHIBSP_LOGCAT ".DummyRequest"), m_addr("192.168.0.1") {
             setRequestURI(uri);
         }
+        const char* getRequestID() const { return nullptr; }
         const char* getMethod() const { return nullptr; }
         const char* getScheme() const { return m_scheme.c_str(); }
         const char* getHostname() const { return m_hostname.c_str(); }

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


More information about the commits mailing list