[cpp-sp] branch main updated: Remove CommonDomainCookie usage.
Scott Cantor
cantor.2 at osu.edu
Mon Nov 4 19:08:39 UTC 2024
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=4d0e57be69e232f318079293d2a358ac0b73f4c8
The following commit(s) were added to refs/heads/main by this push:
new 4d0e57be Remove CommonDomainCookie usage.
4d0e57be is described below
commit 4d0e57be69e232f318079293d2a358ac0b73f4c8
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Nov 4 14:08:33 2024 -0500
Remove CommonDomainCookie usage.
---
Projects/vc15/shibsp/shibsp.vcxproj | 3 -
shibsp/Makefile.am | 3 -
shibsp/handler/AssertionConsumerService.h | 7 +-
shibsp/handler/SessionInitiator.h | 3 -
shibsp/handler/impl/AssertionConsumerService.cpp | 71 --------------
shibsp/handler/impl/CookieSessionInitiator.cpp | 97 -------------------
shibsp/handler/impl/SessionInitiator.cpp | 2 -
shibsp/lite/CommonDomainCookie.cpp | 113 -----------------------
shibsp/lite/CommonDomainCookie.h | 84 -----------------
9 files changed, 1 insertion(+), 382 deletions(-)
diff --git a/Projects/vc15/shibsp/shibsp.vcxproj b/Projects/vc15/shibsp/shibsp.vcxproj
index 1f46ccdf..8ff3d7df 100644
--- a/Projects/vc15/shibsp/shibsp.vcxproj
+++ b/Projects/vc15/shibsp/shibsp.vcxproj
@@ -231,7 +231,6 @@
<ClCompile Include="..\..\..\shibsp\handler\impl\AssertionLookup.cpp" />
<ClCompile Include="..\..\..\shibsp\handler\impl\ChainingLogoutInitiator.cpp" />
<ClCompile Include="..\..\..\shibsp\handler\impl\ChainingSessionInitiator.cpp" />
- <ClCompile Include="..\..\..\shibsp\handler\impl\CookieSessionInitiator.cpp" />
<ClCompile Include="..\..\..\shibsp\handler\impl\FormSessionInitiator.cpp" />
<ClCompile Include="..\..\..\shibsp\handler\impl\LocalLogoutInitiator.cpp" />
<ClCompile Include="..\..\..\shibsp\handler\impl\LogoutHandler.cpp" />
@@ -245,7 +244,6 @@
<ClCompile Include="..\..\..\shibsp\handler\impl\SessionHandler.cpp" />
<ClCompile Include="..\..\..\shibsp\handler\impl\SessionInitiator.cpp" />
<ClCompile Include="..\..\..\shibsp\handler\impl\StatusHandler.cpp" />
- <ClCompile Include="..\..\..\shibsp\lite\CommonDomainCookie.cpp" />
<ClCompile Include="..\..\..\shibsp\lite\SAMLConstants.cpp" />
<ClCompile Include="..\..\..\shibsp\version.cpp" />
</ItemGroup>
@@ -290,7 +288,6 @@
<ClInclude Include="..\..\..\shibsp\handler\LogoutHandler.h" />
<ClInclude Include="..\..\..\shibsp\handler\RemotedHandler.h" />
<ClInclude Include="..\..\..\shibsp\handler\SessionInitiator.h" />
- <ClInclude Include="..\..\..\shibsp\lite\CommonDomainCookie.h" />
<ClInclude Include="..\..\..\shibsp\lite\SAMLConstants.h" />
</ItemGroup>
<ItemGroup>
diff --git a/shibsp/Makefile.am b/shibsp/Makefile.am
index 2a349313..057a18ae 100644
--- a/shibsp/Makefile.am
+++ b/shibsp/Makefile.am
@@ -48,7 +48,6 @@ handinclude_HEADERS = \
handler/SessionInitiator.h
liteinclude_HEADERS = \
- lite/CommonDomainCookie.h \
lite/SAMLConstants.h
reminclude_HEADERS = \
@@ -88,7 +87,6 @@ libshibsp_la_SOURCES = \
handler/impl/AttributeCheckerHandler.cpp \
handler/impl/ChainingLogoutInitiator.cpp \
handler/impl/ChainingSessionInitiator.cpp \
- handler/impl/CookieSessionInitiator.cpp \
handler/impl/DiscoveryFeed.cpp \
handler/impl/FormSessionInitiator.cpp \
handler/impl/LocalLogoutInitiator.cpp \
@@ -112,7 +110,6 @@ libshibsp_la_SOURCES = \
impl/XMLApplication.cpp \
impl/XMLRequestMapper.cpp \
impl/XMLServiceProvider.cpp \
- lite/CommonDomainCookie.cpp \
lite/SAMLConstants.cpp \
remoting/impl/ddf.cpp \
remoting/impl/ListenerService.cpp \
diff --git a/shibsp/handler/AssertionConsumerService.h b/shibsp/handler/AssertionConsumerService.h
index 2edbb026..2ad89f89 100644
--- a/shibsp/handler/AssertionConsumerService.h
+++ b/shibsp/handler/AssertionConsumerService.h
@@ -209,12 +209,7 @@ namespace shibsp {
xmltooling::HTTPResponse& response,
const char* entityID,
const char* relayState
- ) const;
-
- void maintainHistory(
- const Application& application, const xmltooling::HTTPRequest& request, xmltooling::HTTPResponse& response, const char* entityID
- ) const;
-
+ ) const;
};
#if defined (_MSC_VER)
diff --git a/shibsp/handler/SessionInitiator.h b/shibsp/handler/SessionInitiator.h
index d0dfd796..b527ffab 100644
--- a/shibsp/handler/SessionInitiator.h
+++ b/shibsp/handler/SessionInitiator.h
@@ -105,9 +105,6 @@ namespace shibsp {
/** SessionInitiator that uses HTML form submission from the user. */
#define FORM_SESSION_INITIATOR "Form"
-
- /** SessionInitiator that reads the CDC. */
- #define COOKIE_SESSION_INITIATOR "Cookie"
};
#endif /* __shibsp_sesinitiator_h__ */
diff --git a/shibsp/handler/impl/AssertionConsumerService.cpp b/shibsp/handler/impl/AssertionConsumerService.cpp
index 6c87c576..db24610d 100644
--- a/shibsp/handler/impl/AssertionConsumerService.cpp
+++ b/shibsp/handler/impl/AssertionConsumerService.cpp
@@ -34,33 +34,6 @@
#include "util/SPConstants.h"
# include <ctime>
-#ifndef SHIBSP_LITE
-# include "attribute/Attribute.h"
-# include "attribute/filtering/AttributeFilter.h"
-# include "attribute/filtering/BasicFilteringContext.h"
-# include "attribute/resolver/AttributeExtractor.h"
-# include "attribute/resolver/AttributeResolver.h"
-# include "attribute/resolver/ResolutionContext.h"
-# include "metadata/MetadataProviderCriteria.h"
-# include "security/SecurityPolicy.h"
-# include "security/SecurityPolicyProvider.h"
-# include <boost/iterator/indirect_iterator.hpp>
-# include <saml/exceptions.h>
-# include <saml/SAMLConfig.h>
-# include <saml/saml1/core/Assertions.h>
-# include <saml/saml1/core/Protocols.h>
-# include <saml/saml2/core/Protocols.h>
-# include <saml/saml2/metadata/Metadata.h>
-# include <saml/util/CommonDomainCookie.h>
-using namespace samlconstants;
-using opensaml::saml2md::MetadataProvider;
-using opensaml::saml2md::RoleDescriptor;
-using opensaml::saml2md::EntityDescriptor;
-using opensaml::saml2md::IDPSSODescriptor;
-using opensaml::saml2md::SPSSODescriptor;
-#else
-# include "lite/CommonDomainCookie.h"
-#endif
#include <xmltooling/XMLToolingConfig.h>
#include <xmltooling/util/URLEncoder.h>
@@ -544,47 +517,3 @@ void AssertionConsumerService::extractMessageDetails(const Assertion& assertion,
}
#endif
-
-void AssertionConsumerService::maintainHistory(
- const Application& application, const HTTPRequest& request, HTTPResponse& response, const char* entityID
- ) const
-{
- static const char* defProps="; path=/";
- static const char* sslProps="; path=/; secure";
-
- const PropertySet* sessionProps = application.getPropertySet("Sessions");
- pair<bool,bool> idpHistory = sessionProps->getBool("idpHistory");
-
- if (idpHistory.first && idpHistory.second) {
- pair<bool,const char*> cookieProps = sessionProps->getString("idpHistoryProps");
- if (!cookieProps.first)
- cookieProps = sessionProps->getString("cookieProps");
- if (!cookieProps.first || !strcmp(cookieProps.second, "http"))
- cookieProps.second = defProps;
- else if (!strcmp(cookieProps.second, "https"))
- cookieProps.second = sslProps;
-
- // Set an IdP history cookie locally (essentially just a CDC).
- CommonDomainCookie cdc(request.getCookie(CommonDomainCookie::CDCName));
-
- // Either leave in memory or set an expiration.
- pair<bool,unsigned int> days = sessionProps->getUnsignedInt("idpHistoryDays");
- if (!days.first || days.second == 0) {
- string c = string(cdc.set(entityID)) + cookieProps.second;
- response.setCookie(CommonDomainCookie::CDCName, c.c_str());
- }
- else {
- time_t now = time(nullptr) + (days.second * 24 * 60 * 60);
-#ifdef HAVE_GMTIME_R
- struct tm res;
- struct tm* ptime = gmtime_r(&now,&res);
-#else
- struct tm* ptime = gmtime(&now);
-#endif
- char timebuf[64];
- strftime(timebuf,64,"%a, %d %b %Y %H:%M:%S GMT", ptime);
- string c = string(cdc.set(entityID)) + cookieProps.second + "; expires=" + timebuf;
- response.setCookie(CommonDomainCookie::CDCName, c.c_str());
- }
- }
-}
diff --git a/shibsp/handler/impl/CookieSessionInitiator.cpp b/shibsp/handler/impl/CookieSessionInitiator.cpp
deleted file mode 100644
index aa264488..00000000
--- a/shibsp/handler/impl/CookieSessionInitiator.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * 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.
- */
-
-/**
- * CookieSessionInitiator.cpp
- *
- * Cookie-based IdP discovery.
- */
-
-#include "internal.h"
-#include "Application.h"
-#include "exceptions.h"
-#include "handler/AbstractHandler.h"
-#include "handler/SessionInitiator.h"
-
-#ifndef SHIBSP_LITE
-# include <saml/util/CommonDomainCookie.h>
-#else
-# include "lite/CommonDomainCookie.h"
-#endif
-
-#include <xmltooling/XMLToolingConfig.h>
-#include <xmltooling/util/URLEncoder.h>
-
-using namespace shibsp;
-using namespace opensaml;
-using namespace xmltooling;
-using namespace std;
-
-namespace shibsp {
-
-#if defined (_MSC_VER)
- #pragma warning( push )
- #pragma warning( disable : 4250 )
-#endif
-
- class SHIBSP_DLLLOCAL CookieSessionInitiator : public SessionInitiator, public AbstractHandler
- {
- public:
- CookieSessionInitiator(const DOMElement* e, const char* appId)
- : AbstractHandler(e, Category::getInstance(SHIBSP_LOGCAT ".SessionInitiator.Cookie")),
- m_followMultiple(getBool("followMultiple").second) {
- m_supportedOptions.insert("isPassive");
-
- SPConfig::getConfig().deprecation().warn(COOKIE_SESSION_INITIATOR" SessionInitiator is slated for removal");
- }
- virtual ~CookieSessionInitiator() {}
-
- pair<bool,long> run(SPRequest& request, string& entityID, bool isHandler=true) const;
-
- private:
- bool m_followMultiple;
- };
-
-#if defined (_MSC_VER)
- #pragma warning( pop )
-#endif
-
- SessionInitiator* SHIBSP_DLLLOCAL CookieSessionInitiatorFactory(const pair<const DOMElement*,const char*>& p, bool)
- {
- return new CookieSessionInitiator(p.first, p.second);
- }
-
-};
-
-pair<bool,long> CookieSessionInitiator::run(SPRequest& request, string& entityID, bool isHandler) const
-{
- // The IdP CANNOT be specified for us to run.
- if (!entityID.empty() || !checkCompatibility(request, isHandler))
- return make_pair(false,0L);
-
- // If there's no entityID yet, we can check for cookie processing.
- CommonDomainCookie cdc(request.getCookie(CommonDomainCookie::CDCName));
- if ((m_followMultiple && cdc.get().size() > 0) || (!m_followMultiple && cdc.get().size() == 1)) {
- entityID = cdc.get().back();
- m_log.info("set entityID (%s) from IdP history cookie", entityID.c_str());
- }
-
- return make_pair(false,0L);
-}
diff --git a/shibsp/handler/impl/SessionInitiator.cpp b/shibsp/handler/impl/SessionInitiator.cpp
index 7090ee14..12f5cf8c 100644
--- a/shibsp/handler/impl/SessionInitiator.cpp
+++ b/shibsp/handler/impl/SessionInitiator.cpp
@@ -43,7 +43,6 @@ namespace shibsp {
SHIBSP_DLLLOCAL PluginManager< SessionInitiator,string,pair<const DOMElement*,const char*> >::Factory SAML2SessionInitiatorFactory;
SHIBSP_DLLLOCAL PluginManager< SessionInitiator,string,pair<const DOMElement*,const char*> >::Factory SAMLDSSessionInitiatorFactory;
SHIBSP_DLLLOCAL PluginManager< SessionInitiator,string,pair<const DOMElement*,const char*> >::Factory FormSessionInitiatorFactory;
- SHIBSP_DLLLOCAL PluginManager< SessionInitiator,string,pair<const DOMElement*,const char*> >::Factory CookieSessionInitiatorFactory;
};
void SHIBSP_API shibsp::registerSessionInitiators()
@@ -53,7 +52,6 @@ void SHIBSP_API shibsp::registerSessionInitiators()
conf.SessionInitiatorManager.registerFactory(SAML2_SESSION_INITIATOR, SAML2SessionInitiatorFactory);
conf.SessionInitiatorManager.registerFactory(SAMLDS_SESSION_INITIATOR, SAMLDSSessionInitiatorFactory);
conf.SessionInitiatorManager.registerFactory(FORM_SESSION_INITIATOR, FormSessionInitiatorFactory);
- conf.SessionInitiatorManager.registerFactory(COOKIE_SESSION_INITIATOR, CookieSessionInitiatorFactory);
}
SessionInitiator::SessionInitiator()
diff --git a/shibsp/lite/CommonDomainCookie.cpp b/shibsp/lite/CommonDomainCookie.cpp
deleted file mode 100644
index 3d56edba..00000000
--- a/shibsp/lite/CommonDomainCookie.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * 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.
- */
-
-/**
- * CommonDomainCookie.cpp
- *
- * Helper class for maintaining discovery cookie.
- */
-
-#include "internal.h"
-#include "lite/CommonDomainCookie.h"
-
-#include <xercesc/util/Base64.hpp>
-#include <xmltooling/XMLToolingConfig.h>
-#include <xmltooling/util/URLEncoder.h>
-
-using namespace opensaml;
-using namespace xmltooling;
-using namespace std;
-
-const char CommonDomainCookie::CDCName[] = "_saml_idp";
-
-CommonDomainCookie::CommonDomainCookie(const char* cookie)
-{
- if (!cookie)
- return;
-
- // Copy it so we can URL-decode it.
- char* b64=strdup(cookie);
- XMLToolingConfig::getConfig().getURLEncoder()->decode(b64);
-
- // Chop it up and save off elements.
- vector<string> templist;
- char* ptr=b64;
- while (*ptr) {
- while (*ptr && isspace(*ptr)) ptr++;
- char* end=ptr;
- while (*end && !isspace(*end)) end++;
- templist.push_back(string(ptr,end-ptr));
- ptr=end;
- }
- free(b64);
-
- // Now Base64 decode the list.
- XMLSize_t len;
- for (vector<string>::iterator i=templist.begin(); i!=templist.end(); ++i) {
- XMLByte* decoded=Base64::decode(reinterpret_cast<const XMLByte*>(i->c_str()),&len);
- if (decoded && *decoded) {
- m_list.push_back(reinterpret_cast<char*>(decoded));
- XMLString::release((char**)&decoded);
- }
- }
-}
-
-CommonDomainCookie::~CommonDomainCookie()
-{
-}
-
-const vector<string>& CommonDomainCookie::get() const
-{
- return m_list;
-}
-
-const char* CommonDomainCookie::set(const char* entityID)
-{
- // First scan the list for this IdP.
- for (vector<string>::iterator i=m_list.begin(); i!=m_list.end(); i++) {
- if (*i == entityID) {
- m_list.erase(i);
- break;
- }
- }
-
- // Append it to the end.
- m_list.push_back(entityID);
-
- // Now rebuild the delimited list.
- XMLSize_t len;
- string delimited;
- for (vector<string>::const_iterator j=m_list.begin(); j!=m_list.end(); j++) {
- if (!delimited.empty()) delimited += ' ';
-
- XMLByte* b64=Base64::encode(reinterpret_cast<const XMLByte*>(j->c_str()),j->length(),&len);
- XMLByte *pos, *pos2;
- for (pos=b64, pos2=b64; *pos2; pos2++)
- if (isgraph(*pos2))
- *pos++=*pos2;
- *pos=0;
-
- delimited += reinterpret_cast<char*>(b64);
- XMLString::release((char**)&b64);
- }
-
- m_encoded=XMLToolingConfig::getConfig().getURLEncoder()->encode(delimited.c_str());
- return m_encoded.c_str();
-}
diff --git a/shibsp/lite/CommonDomainCookie.h b/shibsp/lite/CommonDomainCookie.h
deleted file mode 100644
index 6cc69e51..00000000
--- a/shibsp/lite/CommonDomainCookie.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * 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.
- */
-
-/**
- * @file shibsp/lite/CommonDomainCookie.h
- *
- * Helper class for maintaining discovery cookie.
- */
-
-#ifndef __shibsp_cdc_h__
-#define __shibsp_cdc_h__
-
-#include <shibsp/base.h>
-
-#include <string>
-#include <vector>
-
-#if defined (_MSC_VER)
- #pragma warning( push )
- #pragma warning( disable : 4250 4251 )
-#endif
-
-namespace opensaml {
- /**
- * Helper class for maintaining discovery cookie.
- */
- class SHIBSP_API CommonDomainCookie {
- MAKE_NONCOPYABLE(CommonDomainCookie);
- public:
- /**
- * Parses a cookie for reading or writing.
- *
- * @param cookie the raw cookie value
- */
- CommonDomainCookie(const char* cookie);
-
- ~CommonDomainCookie();
-
- /**
- * Returns list of IdPs stored in cookie.
- *
- * @return reference to vector of entityIDs
- */
- const std::vector<std::string>& get() const;
-
- /**
- * Adds/moves an IdP to the front of the list.
- *
- * @param entityID name of IdP to add
- * @return new value of cookie
- */
- const char* set(const char* entityID);
-
- /** Name of cookie ("_saml_idp") */
- static const char CDCName[];
-
- private:
- std::string m_encoded;
- std::vector<std::string> m_list;
- };
-};
-
-#if defined (_MSC_VER)
- #pragma warning( pop )
-#endif
-
-#endif /* __saml_cdc_h__ */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list