[cpp-sp] branch main updated: CPPSP-58 - Implement session NotOnOrAfter feature
Codeberg
noreply at shibboleth.net
Mon May 11 14:12:11 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/d193068130b79076e79a9d675a0b5aeef21fa089
The following commit(s) were added to refs/heads/main by this push:
new d1930681 CPPSP-58 - Implement session NotOnOrAfter feature
d1930681 is described below
commit d193068130b79076e79a9d675a0b5aeef21fa089
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Mon May 11 10:11:43 2026 -0400
CPPSP-58 - Implement session NotOnOrAfter feature
https://shibboleth.atlassian.net/browse/CPPSP-58
Add unit tests.
---
tests/session/impl/FilesystemSessionCacheTests.cpp | 31 ++++++++++++++++++++++
tests/session/impl/MemorySessionCacheTests.cpp | 31 ++++++++++++++++++++++
2 files changed, 62 insertions(+)
diff --git a/tests/session/impl/FilesystemSessionCacheTests.cpp b/tests/session/impl/FilesystemSessionCacheTests.cpp
index 87e5f4e0..099db45f 100644
--- a/tests/session/impl/FilesystemSessionCacheTests.cpp
+++ b/tests/session/impl/FilesystemSessionCacheTests.cpp
@@ -119,6 +119,37 @@ BOOST_FIXTURE_TEST_CASE(FilesystemSessionCache_invalid_attributes, FilesystemFix
BOOST_CHECK_EXCEPTION(cache->create(request, child), SessionException, checker.check_message);
}
+BOOST_FIXTURE_TEST_CASE(FilessystemSessionCache_notonorafter, FilesystemFixture)
+{
+ bool started = AgentConfig::getConfig().start();
+ BOOST_CHECK(started);
+
+ DDF obj = createTestData("foo");
+ obj.addmember("session.notonorafter").longinteger(time(nullptr) - 300);
+ DDFJanitor janitor(obj);
+
+ DummyRequest request("https://sp.example.org/secure/index.html");
+ DDF child = obj["session"];
+
+ SessionCache* cache = AgentConfig::getConfig().getAgent().getSessionCache();
+ string key = cache->create(request, child);
+
+ BOOST_CHECK(obj["session"].isnull());
+ BOOST_CHECK_EQUAL(key.c_str(), child.name());
+ string cookieName("__Host-shibsession_637573746f6d");
+ string header(cookieName);
+ header = header + '=' + key + ".1";
+ header += "; Path=/; Secure=1; HttpOnly=1; SameSite=None";
+ BOOST_CHECK_EQUAL(request.m_responseHeaders["Set-Cookie"], header);
+
+ string cookie(cookieName);
+ cookie = cookie + '=' + key + ".1";
+ request.m_requestHeaders["Cookie"] = cookie;
+
+ unique_lock<Session> session = cache->find(request, true, false);
+ BOOST_CHECK(!session);
+}
+
BOOST_FIXTURE_TEST_CASE(FilesystemSessionCache_tests, FilesystemFixture)
{
bool started = AgentConfig::getConfig().start();
diff --git a/tests/session/impl/MemorySessionCacheTests.cpp b/tests/session/impl/MemorySessionCacheTests.cpp
index 75634c1f..c40a4834 100644
--- a/tests/session/impl/MemorySessionCacheTests.cpp
+++ b/tests/session/impl/MemorySessionCacheTests.cpp
@@ -78,6 +78,37 @@ struct MemoryFixture
/////////////
+BOOST_FIXTURE_TEST_CASE(MemorySessionCache_notonorafter, MemoryFixture)
+{
+ bool started = AgentConfig::getConfig().start();
+ BOOST_CHECK(started);
+
+ DDF obj = createTestData("foo");
+ obj.addmember("session.notonorafter").longinteger(time(nullptr) - 300);
+ DDFJanitor janitor(obj);
+
+ DummyRequest request("https://sp.example.org/secure/index.html");
+ DDF child = obj["session"];
+
+ SessionCache* cache = AgentConfig::getConfig().getAgent().getSessionCache();
+ string key = cache->create(request, child);
+
+ BOOST_CHECK(obj["session"].isnull());
+ BOOST_CHECK_EQUAL(key.c_str(), child.name());
+ string cookieName("__Host-shibsession_637573746f6d");
+ string header(cookieName);
+ header = header + '=' + key + ".1";
+ header += "; Path=/; Secure=1; HttpOnly=1; SameSite=None";
+ BOOST_CHECK_EQUAL(request.m_responseHeaders["Set-Cookie"], header);
+
+ string cookie(cookieName);
+ cookie = cookie + '=' + key + ".1";
+ request.m_requestHeaders["Cookie"] = cookie;
+
+ unique_lock<Session> session = cache->find(request, true, false);
+ BOOST_CHECK(!session);
+}
+
BOOST_FIXTURE_TEST_CASE(MemorySessionCache_tests, MemoryFixture)
{
bool started = AgentConfig::getConfig().start();
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list