initialized = true;
m_cache = dynamic_cast<ISessionCache*>(
- ShibConfig::getConfig().m_plugMgr.newPlugin(
+ SAMLConfig::getConfig().m_plugMgr.newPlugin(
"edu.internet2.middleware.shibboleth.target.provider.MemorySessionCache", e
)
);
extern "C" int SHIBMYSQL_EXPORTS saml_extension_init(void*)
{
// register this ccache type
- ShibConfig::getConfig().m_plugMgr.regFactory(PLUGINTYPE, &new_mysql_ccache);
+ SAMLConfig::getConfig().m_plugMgr.regFactory(PLUGINTYPE, &new_mysql_ccache);
return 0;
}
extern "C" void SHIBMYSQL_EXPORTS saml_extension_term()
{
- ShibConfig::getConfig().m_plugMgr.unregFactory(PLUGINTYPE);
+ SAMLConfig::getConfig().m_plugMgr.unregFactory(PLUGINTYPE);
}
/*************************************************************************
const DOMElement* acl=saml::XML::getFirstChildElement(e,ShibTargetConfig::SHIBTARGET_NS,SHIBT_L(htaccess));
if (acl) {
log.info("building htaccess provider...");
- plugin=ShibConfig::getConfig().m_plugMgr.newPlugin(shibtarget::XML::htaccessType,acl);
+ plugin=SAMLConfig::getConfig().m_plugMgr.newPlugin(shibtarget::XML::htaccessType,acl);
}
else {
acl=saml::XML::getFirstChildElement(e,ShibTargetConfig::SHIBTARGET_NS,SHIBT_L(AccessControlProvider));
if (acl) {
auto_ptr_char type(acl->getAttributeNS(NULL,SHIBT_L(type)));
log.info("building Access Control provider of type %s...",type.get());
- plugin=ShibConfig::getConfig().m_plugMgr.newPlugin(type.get(),acl);
+ plugin=SAMLConfig::getConfig().m_plugMgr.newPlugin(type.get(),acl);
}
}
if (plugin) {
try {
// Register plugin types.
#ifndef WIN32
- shibConf.m_plugMgr.regFactory(shibtarget::XML::UnixListenerType,&UnixListenerFactory);
+ samlConf.m_plugMgr.regFactory(shibtarget::XML::UnixListenerType,&UnixListenerFactory);
#endif
- shibConf.m_plugMgr.regFactory(shibtarget::XML::TCPListenerType,&TCPListenerFactory);
- shibConf.m_plugMgr.regFactory(shibtarget::XML::MemorySessionCacheType,&MemoryCacheFactory);
- shibConf.m_plugMgr.regFactory(shibtarget::XML::RequestMapType,&XMLRequestMapFactory);
+ samlConf.m_plugMgr.regFactory(shibtarget::XML::TCPListenerType,&TCPListenerFactory);
+ samlConf.m_plugMgr.regFactory(shibtarget::XML::MemorySessionCacheType,&MemoryCacheFactory);
+ samlConf.m_plugMgr.regFactory(shibtarget::XML::RequestMapType,&XMLRequestMapFactory);
//shibConf.m_plugMgr.regFactory(shibtarget::XML::htaccessType,&htaccessFactory);
saml::XML::registerSchema(ShibTargetConfig::SHIBTARGET_NS,shibtarget::XML::SHIBTARGET_SCHEMA_ID);
load(e,log,this);
ShibTargetConfig& conf=ShibTargetConfig::getConfig();
- ShibConfig& shibConf=ShibConfig::getConfig();
+ SAMLConfig& shibConf=SAMLConfig::getConfig();
int i;
DOMNodeList* nlist=e->getElementsByTagNameNS(saml::XML::SAML_NS,L(AttributeDesignator));
for (i=0; nlist && i<nlist->getLength(); i++) {
throw MalformedException("Construction requires a valid configuration file: (conf:ShibbolethTargetConfig as root element)");
}
- ShibConfig& shibConf=ShibConfig::getConfig();
+ SAMLConfig& shibConf=SAMLConfig::getConfig();
ShibTargetConfig& conf=ShibTargetConfig::getConfig();
const DOMElement* SHAR=saml::XML::getFirstChildElement(ReloadableXMLFileImpl::m_root,ShibTargetConfig::SHIBTARGET_NS,SHIBT_L(SHAR));
const DOMElement* SHIRE=saml::XML::getFirstChildElement(ReloadableXMLFileImpl::m_root,ShibTargetConfig::SHIBTARGET_NS,SHIBT_L(SHIRE));
virtual ~IPropertySet() {}
};
- struct SHIBTARGET_EXPORTS IListener : public virtual shibboleth::IPlugIn
+ struct SHIBTARGET_EXPORTS IListener : public virtual saml::IPlugIn
{
#ifdef WIN32
typedef SOCKET ShibSocket;
virtual ~IListener() {}
};
- struct SHIBTARGET_EXPORTS IAccessControl : public virtual shibboleth::ILockable, public virtual shibboleth::IPlugIn
+ struct SHIBTARGET_EXPORTS IAccessControl : public virtual saml::ILockable, public virtual saml::IPlugIn
{
virtual bool authorized(
const saml::SAMLAuthenticationStatement& authn, const saml::Iterator<saml::SAMLAssertion*>& attrs
virtual ~IAccessControl() {}
};
- struct SHIBTARGET_EXPORTS IRequestMapper : public virtual shibboleth::ILockable, public virtual shibboleth::IPlugIn
+ struct SHIBTARGET_EXPORTS IRequestMapper : public virtual saml::ILockable, public virtual saml::IPlugIn
{
typedef std::pair<const IPropertySet*,IAccessControl*> Settings;
virtual Settings getSettingsFromURL(const char* url) const=0;
virtual ~IApplication() {}
};
- struct SHIBTARGET_EXPORTS ISessionCacheEntry : public virtual shibboleth::ILockable
+ struct SHIBTARGET_EXPORTS ISessionCacheEntry : public virtual saml::ILockable
{
virtual bool isValid(time_t lifetime, time_t timeout) const=0;
virtual const char* getClientAddress() const=0;
virtual ~ISessionCacheEntry() {}
};
- struct SHIBTARGET_EXPORTS ISessionCache : public virtual shibboleth::IPlugIn
+ struct SHIBTARGET_EXPORTS ISessionCache : public virtual saml::IPlugIn
{
virtual void thread_init()=0;
virtual void thread_end()=0;
virtual ~ISessionCache() {}
};
- struct SHIBTARGET_EXPORTS IConfig : public virtual shibboleth::ILockable, public virtual IPropertySet, public virtual shibboleth::IPlugIn
+ struct SHIBTARGET_EXPORTS IConfig : public virtual saml::ILockable, public virtual IPropertySet, public virtual saml::IPlugIn
{
virtual const IListener* getListener() const=0;
virtual ISessionCache* getSessionCache() const=0;
g_openssl_locks.clear();
}
-void PlugManager::regFactory(const char* type, Factory* factory)
-{
- if (type && factory)
- m_map[type]=factory;
-}
-
-IPlugIn* PlugManager::newPlugin(const char* type, const DOMElement* source)
-{
- FactoryMap::const_iterator i=m_map.find(type);
- if (i==m_map.end())
- throw saml::UnsupportedExtensionException(std::string("unable to build plugin of type '") + type + "'");
- return i->second(source);
-}
-
-void PlugManager::unregFactory(const char* type)
-{
- if (type)
- m_map.erase(type);
-}
-
ShibConfig& ShibConfig::getConfig()
{
return g_config;
DECLARE_SHIB_EXCEPTION(CredentialException,SAMLException);
DECLARE_SHIB_EXCEPTION(InvalidHandleException,RetryableProfileException);
- // Manages pluggable implementations of interfaces
- // Would prefer this to be a template, but the Windows STL isn't DLL-safe.
-
- struct SHIB_EXPORTS IPlugIn
- {
- virtual ~IPlugIn() {}
- };
-
- class SHIB_EXPORTS PlugManager
- {
- public:
- PlugManager() {}
- ~PlugManager() {}
-
- typedef IPlugIn* Factory(const DOMElement* source);
- void regFactory(const char* type, Factory* factory);
- void unregFactory(const char* type);
- IPlugIn* newPlugin(const char* type, const DOMElement* source);
-
- private:
- typedef std::map<std::string, Factory*> FactoryMap;
- FactoryMap m_map;
- };
-
- // Various interfaces inherit from this to support locking
- struct SHIB_EXPORTS ILockable
- {
- virtual void lock()=0;
- virtual void unlock()=0;
- virtual ~ILockable() {}
- };
-
// Metadata abstract interfaces, based on SAML 2.0
struct SHIB_EXPORTS IContactPerson
virtual ~IScopedRoleDescriptor() {}
};
- struct SHIB_EXPORTS IMetadata : public virtual ILockable, public virtual IPlugIn
+ struct SHIB_EXPORTS IMetadata : public virtual saml::ILockable, public virtual saml::IPlugIn
{
virtual const IEntityDescriptor* lookup(const XMLCh* id) const=0;
virtual ~IMetadata() {}
};
- struct SHIB_EXPORTS IRevocation : public virtual ILockable, public virtual IPlugIn
+ struct SHIB_EXPORTS IRevocation : public virtual saml::ILockable, public virtual saml::IPlugIn
{
virtual saml::Iterator<void*> getRevocationLists(const IEntityDescriptor* provider, const IRoleDescriptor* role=NULL) const=0;
virtual ~IRevocation() {}
// Trust interface hides *all* details of signature and SSL validation.
// Pluggable providers can fully override the Shibboleth trust model here.
- struct SHIB_EXPORTS ITrust : public virtual IPlugIn
+ struct SHIB_EXPORTS ITrust : public virtual saml::IPlugIn
{
virtual bool validate(
const saml::Iterator<IRevocation*>& revocations,
// Credentials interface abstracts access to "owned" keys and certificates.
- struct SHIB_EXPORTS ICredResolver : public virtual IPlugIn
+ struct SHIB_EXPORTS ICredResolver : public virtual saml::IPlugIn
{
virtual void attach(void* ctx) const=0;
virtual XSECCryptoKey* getKey() const=0;
virtual ~ICredResolver() {}
};
- struct SHIB_EXPORTS ICredentials : public virtual ILockable, public virtual IPlugIn
+ struct SHIB_EXPORTS ICredentials : public virtual saml::ILockable, public virtual saml::IPlugIn
{
virtual const ICredResolver* lookup(const char* id) const=0;
virtual ~ICredentials() {}
virtual ~IAttributeRule() {}
};
- struct SHIB_EXPORTS IAAP : public virtual ILockable, public virtual IPlugIn
+ struct SHIB_EXPORTS IAAP : public virtual saml::ILockable, public virtual saml::IPlugIn
{
virtual bool anyAttribute() const=0;
virtual const IAttributeRule* lookup(const XMLCh* attrName, const XMLCh* attrNamespace=NULL) const=0;
// Glue classes between abstract metadata and concrete providers
- class SHIB_EXPORTS Locker
- {
- public:
- Locker(ILockable* lockee) : m_lockee(lockee) {m_lockee->lock();}
- ~Locker() {if (m_lockee) m_lockee->unlock();}
-
- private:
- Locker(const Locker&);
- void operator=(const Locker&);
- ILockable* m_lockee;
- };
-
class SHIB_EXPORTS Metadata
{
public:
// enables runtime and clients to access configuration
static ShibConfig& getConfig();
-
- // allows pluggable implementations of metadata and configuration data
- PlugManager m_plugMgr;
};
/* Helper classes for implementing reloadable XML-based config files
const DOMElement* m_root;
};
- class SHIB_EXPORTS ReloadableXMLFile : protected virtual ILockable
+ class SHIB_EXPORTS ReloadableXMLFile : protected virtual saml::ILockable
{
public:
ReloadableXMLFile(const DOMElement* e);
dummy->setAttributeNS(NULL,url,src.get());
IMetadata* metadatas[1];
- metadatas[0]=dynamic_cast<IMetadata*>(conf2.m_plugMgr.newPlugin("edu.internet2.middleware.shibboleth.provider.XMLMetadata",dummy));
+ metadatas[0]=dynamic_cast<IMetadata*>(conf1.m_plugMgr.newPlugin("edu.internet2.middleware.shibboleth.provider.XMLMetadata",dummy));
dummydoc->release();
ArrayIterator<IMetadata*> sites(metadatas,1);
if (!cr_type.empty()) {
try {
- IPlugIn* plugin=ShibConfig::getConfig().m_plugMgr.newPlugin(cr_type.c_str(),child);
+ IPlugIn* plugin=SAMLConfig::getConfig().m_plugMgr.newPlugin(cr_type.c_str(),child);
ICredResolver* cr=dynamic_cast<ICredResolver*>(plugin);
if (cr)
m_resolverMap[id.get()]=cr;
saml::XML::registerSchema(::XML::XMLENC_NS,::XML::XMLENC_SCHEMA_ID);
// Register metadata factories
- ShibConfig& conf=ShibConfig::getConfig();
+ SAMLConfig& conf=SAMLConfig::getConfig();
conf.m_plugMgr.regFactory("edu.internet2.middleware.shibboleth.common.provider.XMLMetadata",&XMLMetadataFactory);
conf.m_plugMgr.regFactory("edu.internet2.middleware.shibboleth.common.provider.XMLRevocation",&XMLRevocationFactory);
conf.m_plugMgr.regFactory("edu.internet2.middleware.shibboleth.common.provider.XMLTrust",&XMLTrustFactory);
extern "C" void XML_EXPORTS saml_extension_term()
{
// Unregister metadata factories
- ShibConfig& conf=ShibConfig::getConfig();
+ SAMLConfig& conf=SAMLConfig::getConfig();
conf.m_plugMgr.unregFactory("edu.internet2.middleware.shibboleth.common.provider.XMLMetadata");
conf.m_plugMgr.unregFactory("edu.internet2.middleware.shibboleth.common.provider.XMLRevocation");
conf.m_plugMgr.unregFactory("edu.internet2.middleware.shibboleth.common.provider.XMLTrust");