-/*
- * Licensed to UCAID under one or more contributor license agreements.
- * See the NOTICE file distributed with this work for additional information
- * regarding copyright ownership. The ASF 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
+/**
+ * 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
+ * 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.
+ * 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.
*/
/**
#include "ServiceProvider.h"
#include "SessionCache.h"
#include "SPConfig.h"
-#include "TransactionLog.h"
#include "attribute/Attribute.h"
#include "binding/ProtocolProvider.h"
#include "handler/LogoutInitiator.h"
using namespace shibsp;
using namespace opensaml;
using namespace xmltooling;
+using namespace boost;
using namespace std;
DECL_XMLTOOLING_EXCEPTION_FACTORY(AttributeException,shibsp);
class SHIBSP_DLLLOCAL SPInternalConfig : public SPConfig
{
public:
- SPInternalConfig();
- ~SPInternalConfig();
+ SPInternalConfig() : m_initCount(0), m_lock(Mutex::create()) {}
+ ~SPInternalConfig() {}
bool init(const char* catalog_path=nullptr, const char* inst_prefix=nullptr);
void term();
private:
int m_initCount;
- Mutex* m_lock;
+ scoped_ptr<Mutex> m_lock;
};
SPInternalConfig g_config;
++inst_prefix;
}
- const char* loglevel=getenv("SHIBSP_LOGGING");
- if (!loglevel)
- loglevel = SHIBSP_LOGGING;
- std::string ll(loglevel);
+ const char* logconf = getenv("SHIBSP_LOGGING");
+ if (!logconf || !*logconf) {
+ if (isEnabled(SPConfig::Logging) && isEnabled(SPConfig::OutOfProcess) && !isEnabled(SPConfig::InProcess))
+ logconf = SHIBSP_OUTOFPROC_LOGGING;
+ else if (isEnabled(SPConfig::Logging) && isEnabled(SPConfig::InProcess) && !isEnabled(SPConfig::OutOfProcess))
+ logconf = SHIBSP_INPROC_LOGGING;
+ else
+ logconf = SHIBSP_LOGGING;
+ }
PathResolver localpr;
localpr.setDefaultPrefix(inst_prefix2.c_str());
inst_prefix = getenv("SHIBSP_CFGDIR");
- if (!inst_prefix)
+ if (!inst_prefix || !*inst_prefix)
inst_prefix = SHIBSP_CFGDIR;
localpr.setCfgDir(inst_prefix);
- XMLToolingConfig::getConfig().log_config(localpr.resolve(ll, PathResolver::XMLTOOLING_CFG_FILE, PACKAGE_NAME).c_str());
+ std::string lc(logconf);
+ XMLToolingConfig::getConfig().log_config(localpr.resolve(lc, PathResolver::XMLTOOLING_CFG_FILE, PACKAGE_NAME).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");
- if (!catalog_path)
- catalog_path = SHIBSP_SCHEMAS;
- XMLToolingConfig::getConfig().catalog_path = catalog_path;
-
#ifndef SHIBSP_LITE
XMLToolingConfig::getConfig().user_agent = string(PACKAGE_NAME) + '/' + PACKAGE_VERSION +
" OpenSAML/" + gOpenSAMLDotVersionStr +
return false;
}
#endif
+ if (!catalog_path)
+ catalog_path = getenv("SHIBSP_SCHEMAS");
+ if (!catalog_path || !*catalog_path)
+ catalog_path = SHIBSP_SCHEMAS;
+ if (!XMLToolingConfig::getConfig().getValidatingParser().loadCatalogs(catalog_path)) {
+ log.warn("failed to load schema catalogs into validating parser");
+ }
+
PathResolver* pr = XMLToolingConfig::getConfig().getPathResolver();
pr->setDefaultPackageName(PACKAGE_NAME);
pr->setDefaultPrefix(inst_prefix2.c_str());
pr->setCfgDir(inst_prefix);
inst_prefix = getenv("SHIBSP_LIBDIR");
- if (!inst_prefix)
+ if (!inst_prefix || !*inst_prefix)
inst_prefix = SHIBSP_LIBDIR;
pr->setLibDir(inst_prefix);
inst_prefix = getenv("SHIBSP_LOGDIR");
- if (!inst_prefix)
+ if (!inst_prefix || !*inst_prefix)
inst_prefix = SHIBSP_LOGDIR;
pr->setLogDir(inst_prefix);
inst_prefix = getenv("SHIBSP_RUNDIR");
- if (!inst_prefix)
+ if (!inst_prefix || !*inst_prefix)
inst_prefix = SHIBSP_RUNDIR;
pr->setRunDir(inst_prefix);
+ inst_prefix = getenv("SHIBSP_CACHEDIR");
+ if (!inst_prefix || !*inst_prefix)
+ inst_prefix = SHIBSP_CACHEDIR;
+ pr->setCacheDir(inst_prefix);
inst_prefix = getenv("SHIBSP_XMLDIR");
- if (!inst_prefix)
+ if (!inst_prefix || !*inst_prefix)
inst_prefix = SHIBSP_XMLDIR;
pr->setXMLDir(inst_prefix);
registerAttributeFilters();
registerMatchFunctors();
}
+ if (isEnabled(Logging)) {
+ registerEvents();
+ }
registerSecurityPolicyProviders();
#endif
#ifndef SHIBSP_LITE
SecurityPolicyProviderManager.deregisterFactories();
+ if (isEnabled(Logging)) {
+ EventManager.deregisterFactories();
+ }
if (isEnabled(AttributeResolution)) {
MatchFunctorManager.deregisterFactories();
AttributeFilterManager.deregisterFactories();
return false;
}
-SPInternalConfig::SPInternalConfig() : m_initCount(0), m_lock(Mutex::create())
-{
-}
-
-SPInternalConfig::~SPInternalConfig()
-{
- delete m_lock;
-}
-
bool SPInternalConfig::init(const char* catalog_path, const char* inst_prefix)
{
#ifdef _DEBUG
SPConfig::term();
}
-
-
-TransactionLog::TransactionLog() : log(logging::Category::getInstance(SHIBSP_TX_LOGCAT)), m_lock(Mutex::create())
-{
-}
-
-TransactionLog::~TransactionLog()
-{
- delete m_lock;
-}
-
-Lockable* TransactionLog::lock()
-{
- m_lock->lock();
- return this;
-}
-
-void TransactionLog::unlock()
-{
- m_lock->unlock();
-}