*/
#include "internal.h"
+
+#if defined(XMLTOOLING_LOG4SHIB)
+# ifndef SHIBSP_LOG4SHIB
+# error "Logging library mismatch (XMLTooling is using log4shib)."
+# endif
+#elif defined(XMLTOOLING_LOG4CPP)
+# ifndef SHIBSP_LOG4CPP
+# error "Logging library mismatch (XMLTooling is using log4cpp)."
+# endif
+#else
+# error "No supported logging library."
+#endif
+
#include "AccessControl.h"
#include "exceptions.h"
#include "RequestMapper.h"
# include "metadata/MetadataExt.h"
# include "security/PKIXTrustEngine.h"
# include <saml/SAMLConfig.h>
+# include <xmltooling/util/CurlNetAccessor.hpp>
#else
# include <xmltooling/XMLToolingConfig.h>
#endif
-#include <log4cpp/Category.hh>
#include <xmltooling/util/NDC.h>
+#include <xmltooling/util/PathResolver.h>
#include <xmltooling/util/TemplateEngine.h>
using namespace shibsp;
using namespace opensaml;
using namespace xmltooling;
-using namespace log4cpp;
DECL_XMLTOOLING_EXCEPTION_FACTORY(AttributeException,shibsp);
DECL_XMLTOOLING_EXCEPTION_FACTORY(AttributeExtractionException,shibsp);
DECL_XMLTOOLING_EXCEPTION_FACTORY(ListenerException,shibsp);
#ifdef SHIBSP_LITE
-DECL_XMLTOOLING_EXCEPTION_FACTORY(MetadataException,opensaml::saml2md);
+DECL_XMLTOOLING_EXCEPTION_FACTORY(BindingException,opensaml);
DECL_XMLTOOLING_EXCEPTION_FACTORY(SecurityPolicyException,opensaml);
DECL_XMLTOOLING_EXCEPTION_FACTORY(ProfileException,opensaml);
DECL_XMLTOOLING_EXCEPTION_FACTORY(FatalProfileException,opensaml);
DECL_XMLTOOLING_EXCEPTION_FACTORY(RetryableProfileException,opensaml);
+DECL_XMLTOOLING_EXCEPTION_FACTORY(MetadataException,opensaml::saml2md);
#endif
namespace shibsp {
- SPInternalConfig g_config;
+ SPConfig g_config;
}
SPConfig& SPConfig::getConfig()
return g_config;
}
-SPInternalConfig& SPInternalConfig::getInternalConfig()
-{
- return g_config;
-}
-
void SPConfig::setServiceProvider(ServiceProvider* serviceProvider)
{
delete m_serviceProvider;
m_serviceProvider = serviceProvider;
}
-bool SPInternalConfig::init(const char* catalog_path)
+bool SPConfig::init(const char* catalog_path, const char* inst_prefix)
{
#ifdef _DEBUG
NDC ndc("init");
#endif
- Category& log=Category::getInstance(SHIBSP_LOGCAT".Config");
- log.debug("library initialization started");
-
+ if (!inst_prefix)
+ inst_prefix = getenv("SHIBSP_PREFIX");
+ if (!inst_prefix)
+ inst_prefix = SHIBSP_PREFIX;
+
const char* loglevel=getenv("SHIBSP_LOGGING");
if (!loglevel)
loglevel = SHIBSP_LOGGING;
- XMLToolingConfig::getConfig().log_config(loglevel);
+ std::string ll(loglevel);
+ PathResolver localpr;
+ XMLToolingConfig::getConfig().log_config(localpr.resolve(ll, PathResolver::XMLTOOLING_CFG_FILE, PACKAGE_NAME, inst_prefix).c_str());
+
+ Category& log=Category::getInstance(SHIBSP_LOGCAT".Config");
+ log.debug("%s library initialization started", PACKAGE_STRING);
if (!catalog_path)
catalog_path = getenv("SHIBSP_SCHEMAS");
log.fatal("failed to initialize OpenSAML library");
return false;
}
+ XMLPlatformUtils::fgNetAccessor = new CurlNetAccessor();
#else
if (!XMLToolingConfig::getConfig().init()) {
log.fatal("failed to initialize XMLTooling library");
return false;
}
-#endif
-
+#endif
+ XMLToolingConfig::getConfig().getPathResolver()->setDefaultPackageName(PACKAGE_NAME);
+ XMLToolingConfig::getConfig().getPathResolver()->setDefaultPrefix(inst_prefix);
XMLToolingConfig::getConfig().setTemplateEngine(new TemplateEngine());
XMLToolingConfig::getConfig().getTemplateEngine()->setTagPrefix("shibmlp");
REGISTER_XMLTOOLING_EXCEPTION_FACTORY(ListenerException,shibsp);
#ifdef SHIBSP_LITE
+ REGISTER_XMLTOOLING_EXCEPTION_FACTORY(BindingException,opensaml);
REGISTER_XMLTOOLING_EXCEPTION_FACTORY(SecurityPolicyException,opensaml);
REGISTER_XMLTOOLING_EXCEPTION_FACTORY(ProfileException,opensaml);
REGISTER_XMLTOOLING_EXCEPTION_FACTORY(FatalProfileException,opensaml);
m_artifactResolver = new ArtifactResolver();
#endif
- log.info("library initialization complete");
+ log.info("%s library initialization complete", PACKAGE_STRING);
return true;
}
-void SPInternalConfig::term()
+void SPConfig::term()
{
#ifdef _DEBUG
NDC ndc("term");
#endif
Category& log=Category::getInstance(SHIBSP_LOGCAT".Config");
- log.info("shutting down the library");
+ log.info("%s library shutting down", PACKAGE_STRING);
setServiceProvider(NULL);
#ifndef SHIBSP_LITE
#else
XMLToolingConfig::getConfig().term();
#endif
- log.info("library shutdown complete");
+ log.info("%s library shutdown complete", PACKAGE_STRING);
}