[cpp-sp] branch main updated: Add lifetime check back into read operation impl.

Codeberg noreply at shibboleth.net
Wed Dec 10 20:39:24 UTC 2025


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/f9da64d2d5b1b575720fa97621f0bac32141b89a

The following commit(s) were added to refs/heads/main by this push:
     new f9da64d2 Add lifetime check back into read operation impl.
f9da64d2 is described below

commit f9da64d2d5b1b575720fa97621f0bac32141b89a
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Dec 10 13:39:11 2025 -0700

    Add lifetime check back into read operation impl.
---
 shibsp/session/impl/StorageServiceSessionCache.cpp | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/shibsp/session/impl/StorageServiceSessionCache.cpp b/shibsp/session/impl/StorageServiceSessionCache.cpp
index 96b0725c..f1be78c5 100644
--- a/shibsp/session/impl/StorageServiceSessionCache.cpp
+++ b/shibsp/session/impl/StorageServiceSessionCache.cpp
@@ -137,10 +137,6 @@ DDF StorageServiceSessionCache::cache_read(
     in.addmember("storage_timeout").integer(m_storageTimeout);
     in.addmember("key").string(key);
 
-    // Policy settings to enforce on Hub.
-    if (lifetime) {
-        in.addmember("lifetime").integer(lifetime);
-    }
     if (timeout) {
         in.addmember("timeout").integer(timeout);
     }
@@ -187,6 +183,20 @@ DDF StorageServiceSessionCache::cache_read(
         return DDF();
     }
 
+    if (lifetime) {
+        time_t now = time(nullptr);
+        time_t start = sessionData["ts"].longinteger();
+        if (start + lifetime < now) {
+            if (m_spilog.isInfoEnabled()) {
+                string created(date::format("%FT%TZ", chrono::system_clock::from_time_t(start)));
+                string expired(date::format("%FT%TZ", chrono::system_clock::from_time_t(start + lifetime)));
+                log(INFO_MARK, "session (%s) has expired, created (%s), expired (%s)", key, created.c_str(), expired.c_str());
+            }
+            cache_remove(request, key);
+            return DDF();
+        }
+    }
+
     if (client_addr) {
         const char* family = getAddressFamily(client_addr);
         const char* addr = sessionData[family].string();

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


More information about the commits mailing list