[cpp-sp] branch main updated: Dummy SessionCache for further testing.

Scott Cantor cantor.2 at osu.edu
Mon Jan 27 15:12:53 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=9ae6d870d4e0bd9b8f12817ea7f9f3c1821e42dc

The following commit(s) were added to refs/heads/main by this push:
     new 9ae6d870 Dummy SessionCache for further testing.
9ae6d870 is described below

commit 9ae6d870d4e0bd9b8f12817ea7f9f3c1821e42dc
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Jan 27 10:12:48 2025 -0500

    Dummy SessionCache for further testing.
---
 shibsp/Makefile.am                             |  1 +
 shibsp/impl/DefaultAgent.cpp                   |  3 +-
 shibsp/session/impl/AbstractSessionCache.cpp   |  3 +-
 shibsp/session/impl/FilesystemSessionCache.cpp | 60 ++++++++++++++++++++++++++
 4 files changed, 64 insertions(+), 3 deletions(-)

diff --git a/shibsp/Makefile.am b/shibsp/Makefile.am
index 96a918c5..cd142ca1 100644
--- a/shibsp/Makefile.am
+++ b/shibsp/Makefile.am
@@ -136,6 +136,7 @@ libshibsp_la_SOURCES = \
 	remoting/impl/SecretSource.cpp \
 	remoting/impl/CurlHTTPRemotingService.cpp \
 	session/impl/AbstractSessionCache.cpp \
+	session/impl/FilesystemSessionCache.cpp \
 	util/BoostPropertySet.cpp \
 	util/CGIParser.cpp \
 	util/IPRange.cpp \
diff --git a/shibsp/impl/DefaultAgent.cpp b/shibsp/impl/DefaultAgent.cpp
index 4d05dfdc..08740b51 100644
--- a/shibsp/impl/DefaultAgent.cpp
+++ b/shibsp/impl/DefaultAgent.cpp
@@ -158,8 +158,7 @@ void DefaultAgent::doSessionCache()
 {
     boost::optional<ptree&> child = m_pt.get_child_optional("session-cache");
     if (child) {
-        // TODO: change the expected default type
-        string t(child->get("type", STORAGESERVICE_SESSION_CACHE));
+        string t(child->get("type", FILESYSTEM_SESSION_CACHE));
         m_log.info("building SessionCache of type %s...", t.c_str());
         m_sessionCache.reset(AgentConfig::getConfig().SessionCacheManager.newPlugin(t.c_str(), *child, true));
     } else {
diff --git a/shibsp/session/impl/AbstractSessionCache.cpp b/shibsp/session/impl/AbstractSessionCache.cpp
index 96123bef..3a012c11 100644
--- a/shibsp/session/impl/AbstractSessionCache.cpp
+++ b/shibsp/session/impl/AbstractSessionCache.cpp
@@ -20,6 +20,7 @@
 
 #include "internal.h"
 #include "exceptions.h"
+#include "AgentConfig.h"
 #include "session/SessionCache.h"
 #include "logging/Category.h"
 
@@ -36,7 +37,7 @@ namespace shibsp {
 
 void SHIBSP_API shibsp::registerSessionCaches()
 {
-    //AgentConfig::getConfig().SessionCacheManager.registerFactory(FILESYSTEM_SESSION_CACHE, FilesystemSessionCacheFactory);
+    AgentConfig::getConfig().SessionCacheManager.registerFactory(FILESYSTEM_SESSION_CACHE, FilesystemSessionCacheFactory);
     //AgentConfig::getConfig().SessionCacheManager.registerFactory(STORAGESERVICE_SESSION_CACHE, StorageServiceSessionCacheFactory);
 }
 
diff --git a/shibsp/session/impl/FilesystemSessionCache.cpp b/shibsp/session/impl/FilesystemSessionCache.cpp
new file mode 100644
index 00000000..8874f749
--- /dev/null
+++ b/shibsp/session/impl/FilesystemSessionCache.cpp
@@ -0,0 +1,60 @@
+/**
+ * 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.
+ */
+
+/**
+ * session/impl/FilesystemSessionCache.cpp
+ *
+ * SessionCache implementation using the file system for storage.
+ */
+
+#include "internal.h"
+#include "exceptions.h"
+#include "session/SessionCache.h"
+#include "logging/Category.h"
+
+#include <boost/property_tree/ptree.hpp>
+
+using namespace shibsp;
+using namespace boost::property_tree;
+using namespace std;
+
+namespace {
+    class FilesystemSessionCache : public virtual SessionCache {
+    public:
+        FilesystemSessionCache(const ptree& pt);
+        ~FilesystemSessionCache();
+
+        // For now this is just a dummy implementation to support further development.
+
+        string active(const SPRequest& request) {return "";}
+        Session* find(SPRequest& request, const char* client_addr=nullptr, time_t* timeout=nullptr) {return nullptr;}
+        void remove(SPRequest& request, time_t revocationExp=0) {}
+        Session* find(const char* bucketID, const char* key) {return nullptr;}
+        void remove(const char* bucketID, const char* key, time_t revocationExp=0) {}
+    };
+};
+
+namespace shibsp {
+    SessionCache* SHIBSP_DLLLOCAL FilesystemSessionCacheFactory(ptree& pt, bool deprecationSupport) {
+        return new FilesystemSessionCache(pt);
+    }
+}
+
+FilesystemSessionCache::FilesystemSessionCache(const ptree& pt)
+{
+}
+
+FilesystemSessionCache::~FilesystemSessionCache()
+{
+}

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


More information about the commits mailing list