X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fresolver.git;a=blobdiff_plain;f=shibresolver%2Fresolver.cpp;h=4a54db2956bdc466deb1c97fce0d17ed2b9d6832;hp=9a95fe8c5db22d324cad5c1845f778cc324bcd2e;hb=c9375c5579547a98735c10a658cbffaf906db550;hpb=ebc845ceb5411c95de71a8d7842f68283da60385 diff --git a/shibresolver/resolver.cpp b/shibresolver/resolver.cpp index 9a95fe8..4a54db2 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,42 @@ 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) { + SPConfig::getConfig().setFeatures(features | SPConfig::AttributeResolution | SPConfig::Metadata | SPConfig::Trust); + 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 }