[cpp-sp] branch main updated: Cleanup of dead code and reducing callouts to xmltooling.
Scott Cantor
cantor.2 at osu.edu
Thu Oct 31 13:56:37 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=e602d70cfb2a4774da16fc314251e15b46702327
The following commit(s) were added to refs/heads/main by this push:
new e602d70c Cleanup of dead code and reducing callouts to xmltooling.
e602d70c is described below
commit e602d70cfb2a4774da16fc314251e15b46702327
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Oct 31 09:56:30 2024 -0400
Cleanup of dead code and reducing callouts to xmltooling.
---
shibsp/SPConfig.cpp | 155 +-----------------------------
shibsp/SPConfig.h | 89 -----------------
shibsp/handler/AssertionConsumerService.h | 13 ---
shibsp/handler/LogoutHandler.h | 22 -----
4 files changed, 4 insertions(+), 275 deletions(-)
diff --git a/shibsp/SPConfig.cpp b/shibsp/SPConfig.cpp
index 50268b72..8d1da081 100644
--- a/shibsp/SPConfig.cpp
+++ b/shibsp/SPConfig.cpp
@@ -120,11 +120,7 @@ SPConfig& SPConfig::getConfig()
return g_config;
}
-SPConfig::SPConfig() : attribute_value_delimeter(';'), m_serviceProvider(nullptr),
-#ifndef SHIBSP_LITE
- m_artifactResolver(nullptr),
-#endif
- m_features(0), m_configDoc(nullptr)
+SPConfig::SPConfig() : attribute_value_delimeter(';'), m_serviceProvider(nullptr), m_features(0), m_configDoc(nullptr)
{
}
@@ -157,19 +153,6 @@ void SPConfig::setServiceProvider(ServiceProvider* serviceProvider)
m_serviceProvider = serviceProvider;
}
-#ifndef SHIBSP_LITE
-void SPConfig::setArtifactResolver(MessageDecoder::ArtifactResolver* artifactResolver)
-{
- delete m_artifactResolver;
- m_artifactResolver = artifactResolver;
-}
-
-const MessageDecoder::ArtifactResolver* SPConfig::getArtifactResolver() const
-{
- return m_artifactResolver;
-}
-#endif
-
bool SPConfig::init(const char* catalog_path, const char* inst_prefix)
{
if (!inst_prefix)
@@ -203,35 +186,7 @@ bool SPConfig::init(const char* catalog_path, const char* inst_prefix)
Category& log=Category::getInstance(SHIBSP_LOGCAT ".Config");
log.debug("%s library initialization started", PACKAGE_STRING);
-#ifndef SHIBSP_LITE
- XMLToolingConfig::getConfig().user_agent = string(PACKAGE_NAME) + '/' + PACKAGE_VERSION +
- " OpenSAML/" + gOpenSAMLDotVersionStr +
- " XMLTooling/" + gXMLToolingDotVersionStr +
- " XML-Security-C/" + XSEC_FULLVERSIONDOT +
- " Xerces-C/" + XERCES_FULLVERSIONDOT +
-#if defined(LOG4SHIB_VERSION)
- " log4shib/" + LOG4SHIB_VERSION;
-#elif defined(LOG4CPP_VERSION)
- " log4cpp/" + LOG4CPP_VERSION;
-#endif
- if (!SAMLConfig::getConfig().init()) {
- log.fatal("failed to initialize OpenSAML library");
- return false;
- }
-#else
- XMLToolingConfig::getConfig().user_agent = string(PACKAGE_NAME) + '/' + PACKAGE_VERSION +
- " XMLTooling/" + gXMLToolingDotVersionStr +
- " Xerces-C/" + XERCES_FULLVERSIONDOT +
-#if defined(LOG4SHIB_VERSION)
- " log4shib/" + LOG4SHIB_VERSION;
-#elif defined(LOG4CPP_VERSION)
- " log4cpp/" + LOG4CPP_VERSION;
-#endif
- if (!XMLToolingConfig::getConfig().init()) {
- log.fatal("failed to initialize XMLTooling library");
- return false;
- }
-#endif
+ XMLToolingConfig::getConfig().user_agent = string(PACKAGE_NAME) + '/' + PACKAGE_VERSION;
PathResolver* pr = XMLToolingConfig::getConfig().getPathResolver();
pr->setDefaultPackageName(PACKAGE_NAME);
@@ -285,11 +240,6 @@ bool SPConfig::init(const char* catalog_path, const char* inst_prefix)
REGISTER_XMLTOOLING_EXCEPTION_FACTORY(MetadataException,opensaml::saml2md);
#endif
-#ifndef SHIBSP_LITE
- if (isEnabled(Metadata))
- registerMetadataExtClasses();
-#endif
-
registerAttributeFactories();
if (isEnabled(Handlers)) {
@@ -301,20 +251,6 @@ bool SPConfig::init(const char* catalog_path, const char* inst_prefix)
registerServiceProviders();
-#ifndef SHIBSP_LITE
- if (isEnabled(AttributeResolution)) {
- registerAttributeExtractors();
- registerAttributeDecoders();
- registerAttributeResolvers();
- registerAttributeFilters();
- registerMatchFunctors();
- }
- if (isEnabled(Logging)) {
- registerEvents();
- }
- registerSecurityPolicyProviders();
-#endif
-
if (isEnabled(Listener))
registerListenerServices();
@@ -326,10 +262,8 @@ bool SPConfig::init(const char* catalog_path, const char* inst_prefix)
if (isEnabled(Caching))
registerSessionCaches();
-#ifndef SHIBSP_LITE
- if (isEnabled(OutOfProcess))
- m_artifactResolver = new ArtifactResolver();
-#endif
+ // Yes, this isn't insecure, will review where we do any random generation
+ // after full code cleanup is done.
srand(static_cast<unsigned int>(std::time(nullptr)));
log.info("%s library initialization complete", PACKAGE_STRING);
@@ -345,9 +279,6 @@ void SPConfig::term()
if (m_configDoc)
m_configDoc->release();
m_configDoc = nullptr;
-#ifndef SHIBSP_LITE
- setArtifactResolver(nullptr);
-#endif
if (isEnabled(Handlers)) {
ArtifactResolutionServiceManager.deregisterFactories();
@@ -363,20 +294,6 @@ void SPConfig::term()
ServiceProviderManager.deregisterFactories();
Attribute::deregisterFactories();
-#ifndef SHIBSP_LITE
- SecurityPolicyProviderManager.deregisterFactories();
- if (isEnabled(Logging)) {
- EventManager.deregisterFactories();
- }
- if (isEnabled(AttributeResolution)) {
- MatchFunctorManager.deregisterFactories();
- AttributeFilterManager.deregisterFactories();
- AttributeDecoderManager.deregisterFactories();
- AttributeExtractorManager.deregisterFactories();
- AttributeResolverManager.deregisterFactories();
- }
-#endif
-
if (isEnabled(Listener))
ListenerServiceManager.deregisterFactories();
@@ -388,20 +305,11 @@ void SPConfig::term()
if (isEnabled(Caching))
SessionCacheManager.deregisterFactories();
-#ifndef SHIBSP_LITE
- SAMLConfig::getConfig().term();
-#else
- XMLToolingConfig::getConfig().term();
-#endif
log.info("%s library shutdown complete", PACKAGE_STRING);
}
bool SPConfig::instantiate(const char* config, bool rethrow)
{
-#ifdef _DEBUG
- NDC ndc("instantiate");
-#endif
-
if (!config)
config = getenv("SHIBSP_CONFIG");
if (!config) {
@@ -458,10 +366,6 @@ bool SPConfig::instantiate(const char* config, bool rethrow)
bool SPInternalConfig::init(const char* catalog_path, const char* inst_prefix)
{
-#ifdef _DEBUG
- xmltooling::NDC ndc("init");
-#endif
-
Lock initLock(m_lock);
if (m_initCount == INT_MAX) {
@@ -484,10 +388,6 @@ bool SPInternalConfig::init(const char* catalog_path, const char* inst_prefix)
void SPInternalConfig::term()
{
-#ifdef _DEBUG
- xmltooling::NDC ndc("term");
-#endif
-
Lock initLock(m_lock);
if (m_initCount == 0) {
Category::getInstance(SHIBSP_LOGCAT ".Config").crit("term without corresponding init");
@@ -500,53 +400,6 @@ void SPInternalConfig::term()
SPConfig::term();
}
-#ifndef SHIBSP_LITE
-bool SPConfig::shouldSignOrEncrypt(const char* setting, const char* endpoint, bool isUserAgentPresent)
-{
- if (setting && (!strcmp(setting, "true") || !strcmp(setting, isUserAgentPresent ? "front" : "back"))) {
- return true;
- }
- else if (!setting || !strcmp(setting, "conditional")) {
- if (isUserAgentPresent || !endpoint) {
- return true;
- }
-
- // Conditional on the back channel means to sign if TLS isn't used or if on port 443.
- // This compensates for the fact that using the default TLS port likely implies no use
- // of client TLS by the server, allowing us to migrate off of the back channel with no
- // configuration changes.
-#ifdef HAVE_STRCASECMP
- if (strncasecmp(endpoint, "http://", 7) == 0) {
-#else
- if (strnicmp(endpoint, "http://", 7) == 0) {
-#endif
- return true;
- }
-#ifdef HAVE_STRCASECMP
- else if (strncasecmp(endpoint, "https://", 8) == 0) {
-#else
- else if (strnicmp(endpoint, "https://", 8) == 0) {
-#endif
- const char* colon = strchr(endpoint + 8, ':');
- if (colon) {
-#ifdef HAVE_STRCASECMP
- if (strncasecmp(colon, ":443/", 5) == 0) {
-#else
- if (strnicmp(colon, ":443/", 5) == 0) {
-#endif
- return true;
- }
- }
- else {
- return true;
- }
- }
- }
-
- return false;
-}
-#endif
-
Category& SPConfig::deprecation() const
{
return Category::getInstance(SHIBSP_LOGCAT".DEPRECATION");
diff --git a/shibsp/SPConfig.h b/shibsp/SPConfig.h
index 377c355a..df821803 100644
--- a/shibsp/SPConfig.h
+++ b/shibsp/SPConfig.h
@@ -50,16 +50,6 @@ namespace shibsp {
class SHIBSP_API SessionCache;
class SHIBSP_API SessionInitiator;
-#ifndef SHIBSP_LITE
- class SHIBSP_API AttributeDecoder;
- class SHIBSP_API AttributeExtractor;
- class SHIBSP_API AttributeFilter;
- class SHIBSP_API AttributeResolver;
- class SHIBSP_API FilterPolicyContext;
- class SHIBSP_API MatchFunctor;
- class SHIBSP_API SecurityPolicyProvider;
-#endif
-
#if defined (_MSC_VER)
#pragma warning( push )
#pragma warning( disable : 4250 4251 )
@@ -89,12 +79,6 @@ namespace shibsp {
enum components_t {
Listener = 1,
Caching = 2,
-#ifndef SHIBSP_LITE
- Metadata = 4,
- Trust = 8,
- Credentials = 16,
- AttributeResolution = 32,
-#endif
RequestMapping = 64,
OutOfProcess = 128,
InProcess = 256,
@@ -171,25 +155,6 @@ namespace shibsp {
*/
virtual bool instantiate(const char* config=nullptr, bool rethrow=false);
-#ifndef SHIBSP_LITE
- /**
- * Sets the global ArtifactResolver instance.
- *
- * <p>This method must be externally synchronized with any code that uses the object.
- * Any previously set object is destroyed.
- *
- * @param artifactResolver new ArtifactResolver instance to store
- */
- void setArtifactResolver(opensaml::MessageDecoder::ArtifactResolver* artifactResolver);
-
- /**
- * Returns the global ArtifactResolver instance.
- *
- * @return global ArtifactResolver or nullptr
- */
- const opensaml::MessageDecoder::ArtifactResolver* getArtifactResolver() const;
-#endif
-
/**
* Separator for serialized values of multi-valued attributes.
*
@@ -204,43 +169,6 @@ namespace shibsp {
*/
xmltooling::PluginManager<AccessControl,std::string,const xercesc::DOMElement*> AccessControlManager;
-#ifndef SHIBSP_LITE
- /**
- * Manages factories for AttributeDecoder plugins.
- */
- xmltooling::PluginManager<AttributeDecoder,xmltooling::QName,const xercesc::DOMElement*> AttributeDecoderManager;
-
- /**
- * Manages factories for AttributeExtractor plugins.
- */
- xmltooling::PluginManager<AttributeExtractor,std::string,const xercesc::DOMElement*> AttributeExtractorManager;
-
- /**
- * Manages factories for AttributeFilter plugins.
- */
- xmltooling::PluginManager<AttributeFilter,std::string,const xercesc::DOMElement*> AttributeFilterManager;
-
- /**
- * Manages factories for AttributeResolver plugins.
- */
- xmltooling::PluginManager<AttributeResolver,std::string,const xercesc::DOMElement*> AttributeResolverManager;
-
- /**
- * Manages factories for Event plugins.
- */
- xmltooling::PluginManager<TransactionLog::Event,std::string,void*> EventManager;
-
- /**
- * Manages factories for MatchFunctor plugins.
- */
- xmltooling::PluginManager< MatchFunctor,xmltooling::QName,std::pair<const FilterPolicyContext*,const xercesc::DOMElement*> > MatchFunctorManager;
-
- /**
- * Manages factories for SecurityPolicyProvider plugins.
- */
- xmltooling::PluginManager<SecurityPolicyProvider,std::string,const xercesc::DOMElement*> SecurityPolicyProviderManager;
-#endif
-
/**
* Manages factories for Handler plugins that implement ArtifactResolutionService functionality.
*/
@@ -301,18 +229,6 @@ namespace shibsp {
*/
xmltooling::PluginManager< Handler,std::string,std::pair<const xercesc::DOMElement*,const char*> > SingleLogoutServiceManager;
-#ifndef SHIBSP_LITE
- /**
- * Determine whether messages should be digitally signed or encrypted based on the setting and endpoint.
- *
- * @param setting the applicable "signing" or "encryption" property in effect
- * @param isUserAgentPresent true iff the user agent is mediating the exchange
- * @param URL of endpoint to receive message
- * @return whether requests should be digitally signed or encrypted
- */
- static bool shouldSignOrEncrypt(const char* setting, const char* endpoint, bool isUserAgentPresent);
-#endif
-
/**
* Helper for deprecation warnings about an at-risk feature or setting.
*/
@@ -322,11 +238,6 @@ namespace shibsp {
/** Global ServiceProvider instance. */
ServiceProvider* m_serviceProvider;
-#ifndef SHIBSP_LITE
- /** Global ArtifactResolver instance. */
- opensaml::MessageDecoder::ArtifactResolver* m_artifactResolver;
-#endif
-
private:
unsigned long m_features;
xercesc::DOMDocument* m_configDoc;
diff --git a/shibsp/handler/AssertionConsumerService.h b/shibsp/handler/AssertionConsumerService.h
index 7cf419b7..1bb6f944 100644
--- a/shibsp/handler/AssertionConsumerService.h
+++ b/shibsp/handler/AssertionConsumerService.h
@@ -197,20 +197,10 @@ namespace shibsp {
const std::vector<const opensaml::Assertion*>* tokens=nullptr
) const;
- /**
- * Creates a new LoginEvent for the event log.
- *
- * @param application the Application associated with the event
- * @param request the HTTP client request associated with the event
- * @return a fresh LoginEvent, prepopulated by the input parameters, or nullptr if an error occurs
- */
- virtual LoginEvent* newLoginEvent(const Application& application, const xmltooling::HTTPRequest& request) const;
-
public:
const char* getType() const;
const XMLCh* getProtocolFamily() const;
#endif
- const char* getEventType() const;
private:
std::pair<bool,long> processMessage(
const Application& application, const xmltooling::HTTPRequest& httpRequest, xmltooling::HTTPResponse& httpResponse
@@ -228,9 +218,6 @@ namespace shibsp {
const Application& application, const xmltooling::HTTPRequest& request, xmltooling::HTTPResponse& response, const char* entityID
) const;
-#ifndef SHIBSP_LITE
- boost::scoped_ptr<opensaml::MessageDecoder> m_decoder;
-#endif
};
#if defined (_MSC_VER)
diff --git a/shibsp/handler/LogoutHandler.h b/shibsp/handler/LogoutHandler.h
index 6407e2f0..79c60e38 100644
--- a/shibsp/handler/LogoutHandler.h
+++ b/shibsp/handler/LogoutHandler.h
@@ -31,10 +31,6 @@
namespace shibsp {
-#ifndef SHIBSP_LITE
- class SHIBSP_API LogoutEvent;
-#endif
-
#if defined (_MSC_VER)
#pragma warning( push )
#pragma warning( disable : 4251 )
@@ -75,8 +71,6 @@ namespace shibsp {
*/
void receive(DDF& in, std::ostream& out);
- const char* getEventType() const;
-
protected:
LogoutHandler();
@@ -129,22 +123,6 @@ namespace shibsp {
xmltooling::HTTPResponse& response,
const char* type
) const;
-
-#ifndef SHIBSP_LITE
- /**
- * Creates a new LogoutEvent for the event log.
- *
- * @param application the Application associated with the event
- * @param request the HTTP client request associated with the event, or nullptr
- * @param session the user session associated with the event, or nullptr
- * @return a fresh LogoutEvent, prepopulated by the input parameters, or nullptr if an error occurs
- */
- virtual LogoutEvent* newLogoutEvent(
- const Application& application,
- const xmltooling::HTTPRequest* request=nullptr,
- const Session* session=nullptr
- ) const;
-#endif
};
#if defined (_MSC_VER)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list