X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml2%2Fmetadata%2FMetadataProvider.h;h=a3c39b34529263303480a33384a62b30c88cc33d;hb=58ed1144be743e1ebfa0f5081e9185d771e45678;hp=f773e411c378896735a55e7d99a49d6911d8542b;hpb=0b82e01f64f7b2391cea3762057a09a7db3cef78;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/saml2/metadata/MetadataProvider.h b/saml/saml2/metadata/MetadataProvider.h index f773e41..a3c39b3 100644 --- a/saml/saml2/metadata/MetadataProvider.h +++ b/saml/saml2/metadata/MetadataProvider.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006 Internet2 + * Copyright 2001-2007 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,17 +23,28 @@ #ifndef __saml2_metadataprov_h__ #define __saml2_metadataprov_h__ -#include - -#include -#include +#include +#include +#include +#include namespace opensaml { class SAML_API SAMLArtifact; namespace saml2md { - + + class SAML_API EntityDescriptor; + class SAML_API EntitiesDescriptor; + class SAML_API RoleDescriptor; + class SAML_API MetadataCredentialResolver; + class SAML_API MetadataFilter; + +#if defined (_MSC_VER) + #pragma warning( push ) + #pragma warning( disable : 4251 ) +#endif + /** * Supplies an individual source of metadata. * @@ -41,26 +52,24 @@ namespace opensaml { * dynamic lookup, can include local caching, etc. Providers * MUST be locked before any lookup operations. */ - class SAML_API MetadataProvider : public virtual xmltooling::Lockable + class SAML_API MetadataProvider : public virtual xmltooling::CredentialResolver { MAKE_NONCOPYABLE(MetadataProvider); - protected: /** * Constructor. * * If a DOM is supplied, a set of default logic will be used to identify * and build MetadataFilter plugins and install them into the provider. - * A KeyResolver can also be supplied, or a default resolver will be used. * * The following XML content is supported: * *
    - *
  • <KeyResolver> elements with a type attribute - *
  • <MetadataFilter> elements with a type attribute + *
  • <MetadataFilter> elements with a type attribute and type-specific content *
  • <Exclude> elements representing a BlacklistMetadataFilter *
  • <BlacklistMetadataFilter> element containing <Exclude> elements *
  • <Include> elements representing a WhitelistMetadataFilter + *
  • <SignatureMetadataFilter> element containing a <KeyResolver> element *
  • <WhitelistMetadataFilter> element containing <Include> elements *
* @@ -112,15 +121,6 @@ namespace opensaml { virtual void init()=0; /** - * Returns a KeyResolver associated with this metadata provider, if any. - * - * @return an associated KeyResolver, or NULL - */ - virtual const xmlsignature::KeyResolver* getKeyResolver() const { - return m_resolver; - } - - /** * Gets the entire metadata tree, after the registered filter has been applied. * The caller MUST unlock the provider when finished with the data. * @@ -150,7 +150,7 @@ namespace opensaml { * * @return the entity's metadata or NULL if there is no metadata or no valid metadata */ - virtual const EntityDescriptor* getEntityDescriptor(const char* id, bool requireValidMetadata=true) const; + virtual const EntityDescriptor* getEntityDescriptor(const char* id, bool requireValidMetadata=true) const=0; /** * Gets the metadata for an entity that issued a SAML artifact. If a valid entity is returned, @@ -161,7 +161,7 @@ namespace opensaml { * * @return the entity's metadata or NULL if there is no valid metadata */ - virtual const EntityDescriptor* getEntityDescriptor(const SAMLArtifact* artifact) const; + virtual const EntityDescriptor* getEntityDescriptor(const SAMLArtifact* artifact) const=0; /** * Gets the metadata for a given group of entities. If a valid group is returned, @@ -185,12 +185,9 @@ namespace opensaml { * * @return the group's metadata or NULL if there is no metadata or no valid metadata */ - virtual const EntitiesDescriptor* getEntitiesDescriptor(const char* name, bool requireValidMetadata=true) const; + virtual const EntitiesDescriptor* getEntitiesDescriptor(const char* name, bool requireValidMetadata=true) const=0; protected: - /** Embedded KeyResolver instance. */ - xmlsignature::KeyResolver* m_resolver; - /** * Applies any installed filters to a metadata instance. * @@ -198,45 +195,26 @@ namespace opensaml { */ void doFilters(xmltooling::XMLObject& xmlObject) const; - /** - * Loads an entity into the cache for faster lookup. This includes - * processing known reverse lookup strategies for artifacts. - * - * @param site entity definition - * @param validUntil expiration time of the entity definition - */ - virtual void index(EntityDescriptor* site, time_t validUntil); - - /** - * Loads a group of entities into the cache for faster lookup. - * - * @param group group definition - * @param validUntil expiration time of the group definition - */ - virtual void index(EntitiesDescriptor* group, time_t validUntil); - - /** - * Clear the cache of known entities and groups. - */ - virtual void clearDescriptorIndex(); - private: std::vector m_filters; - - typedef std::multimap sitemap_t; - typedef std::multimap groupmap_t; - sitemap_t m_sites; - sitemap_t m_sources; - groupmap_t m_groups; }; - + +#if defined (_MSC_VER) + #pragma warning( pop ) +#endif + /** * Registers MetadataProvider classes into the runtime. */ void SAML_API registerMetadataProviders(); - /** MetadataProvider based on local XML files */ - #define FILESYSTEM_METADATA_PROVIDER "org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider" + /** MetadataProvider based on local or remote XML file */ + #define XML_METADATA_PROVIDER "XML" + + /** MetadataProvider that wraps a sequence of metadata providers. */ + #define CHAINING_METADATA_PROVIDER "Chaining" + + DECL_XMLTOOLING_EXCEPTION(MetadataException,SAML_EXCEPTIONAPI(SAML_API),opensaml::saml2md,xmltooling::XMLToolingException,Exceptions related to metadata use); }; };