X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-sp-resolver.git;a=blobdiff_plain;f=shibresolver%2Fresolver.cpp;h=2164f82c1559986bc91c52d1ac5a87656b1cf56b;hp=9a95fe8c5db22d324cad5c1845f778cc324bcd2e;hb=2bbbac4547014c2d54e7c83a2696d8f9e39934b4;hpb=4ee32475919ea99609bfb0d4cbf5ced50cbdcd8d diff --git a/shibresolver/resolver.cpp b/shibresolver/resolver.cpp index 9a95fe8..2164f82 100644 --- a/shibresolver/resolver.cpp +++ b/shibresolver/resolver.cpp @@ -35,23 +35,26 @@ using namespace xmltooling; using namespace std; namespace shibresolver { - class SHIBRESOLVER_DLLLOCAL ResolverImpl : public ShibbolethResolver, public Remoted { + class SHIBRESOLVER_DLLLOCAL RemotedResolver : public Remoted { public: - ResolverImpl() {} - ~ResolverImpl() {} + RemotedResolver() {} + ~RemotedResolver() {} - void resolve(); void receive(DDF& in, ostream& out); }; + + static RemotedResolver g_Remoted; }; ShibbolethResolver* ShibbolethResolver::create() { - return new ResolverImpl(); + return new ShibbolethResolver(); } ShibbolethResolver::ShibbolethResolver() { + m_mapper = NULL; + m_sp = NULL; } ShibbolethResolver::~ShibbolethResolver() @@ -112,17 +115,52 @@ RequestMapper::Settings ShibbolethResolver::getSettings() const return m_settings; } -void ResolverImpl::resolve() +void ShibbolethResolver::resolve() +{ +} + +void RemotedResolver::receive(DDF& in, ostream& out) +{ +} + +bool ShibbolethResolver::init(unsigned long features, const char* config, bool rethrow) { + if (features && SPConfig::OutOfProcess) { +#ifndef SHIBSP_LITE + features = features | SPConfig::AttributeResolution | SPConfig::Metadata | SPConfig::Trust | SPConfig::Credentials; +#endif + if (!(features && SPConfig::InProcess)) + features |= SPConfig::Listener; + } + else if (features && SPConfig::InProcess) { + features |= SPConfig::Listener; + } + SPConfig::getConfig().setFeatures(features); + if (!SPConfig::getConfig().init()) + return false; + if (!SPConfig::getConfig().instantiate(config, rethrow)) + return false; + return true; } -void ResolverImpl::receive(DDF& in, ostream& out) +/** + * Shuts down runtime. + * + * Each process using the library SHOULD call this function exactly once before terminating itself. + */ +void ShibbolethResolver::term() { + SPConfig::getConfig().term(); } + extern "C" int SHIBRESOLVER_EXPORTS xmltooling_extension_init(void*) { - // Register factory functions with appropriate plugin managers in the XMLTooling/SAML/SPConfig objects. +#ifdef SHIBRESOLVER_SHIBSP_HAS_REMOTING + SPConfig& conf = SPConfig::getConfig(); + if (conf.isEnabled(SPConfig::OutOfProcess) && !conf.isEnabled(SPConfig::InProcess) && conf.isEnabled(SPConfig::Listener)) + conf.getServiceProvider()->regListener("org.project-moonshot.shibresolver", &g_Remoted); +#endif return 0; // signal success }