X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml2%2Fmetadata%2FAbstractMetadataProvider.h;h=5373048dfc262ee1d899832ef55bd8bd2087a5be;hb=3e12b03ef5f4ad38074b127845f7b08c834cd3cc;hp=c0bc64bb527391b4cdf1e510962f77a0758c5eb7;hpb=58dfaa3ab3e5e09af7a643e58aedbc961884accb;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/saml2/metadata/AbstractMetadataProvider.h b/saml/saml2/metadata/AbstractMetadataProvider.h index c0bc64b..5373048 100644 --- a/saml/saml2/metadata/AbstractMetadataProvider.h +++ b/saml/saml2/metadata/AbstractMetadataProvider.h @@ -25,10 +25,15 @@ #include -namespace opensaml { +#include +#include +#include +namespace opensaml { namespace saml2md { + class SAML_API MetadataFilter; + /** * Base class for caching metadata providers. */ @@ -39,36 +44,35 @@ namespace opensaml { * Constructor. * * If a DOM is supplied, a set of default logic will be used to identify - * and build a KeyResolver plugin and install it into the provider. + * and build a KeyInfoResolver plugin and install it into the provider. * * The following XML content is supported: * *
    - *
  • <KeyResolver> elements with a type attribute + *
  • <KeyInfoResolver> elements with a type attribute *
* * XML namespaces are ignored in the processing of these elements. * * @param e DOM to supply configuration for provider */ - AbstractMetadataProvider(const DOMElement* e=NULL); - - void emitChangeEvent(); + AbstractMetadataProvider(const xercesc::DOMElement* e=NULL); public: virtual ~AbstractMetadataProvider(); - virtual const xmltooling::KeyResolver* getKeyResolver() const { - return m_resolver; - } - - virtual const EntityDescriptor* getEntityDescriptor(const char* id, bool requireValidMetadata=true) const; - virtual const EntityDescriptor* getEntityDescriptor(const SAMLArtifact* artifact) const; - virtual const EntitiesDescriptor* getEntitiesDescriptor(const char* name, bool requireValidMetadata=true) const; + void emitChangeEvent(); + const EntityDescriptor* getEntityDescriptor(const char* id, bool requireValidMetadata=true) const; + const EntityDescriptor* getEntityDescriptor(const SAMLArtifact* artifact) const; + const EntitiesDescriptor* getEntitiesDescriptor(const char* name, bool requireValidMetadata=true) const; + const xmltooling::Credential* resolve(const xmltooling::CredentialCriteria* criteria=NULL) const; + std::vector::size_type resolve( + std::vector& results, const xmltooling::CredentialCriteria* criteria=NULL + ) const; protected: - /** Embedded KeyResolver instance. */ - xmltooling::KeyResolver* m_resolver; + /** Embedded KeyInfoResolver instance. */ + xmltooling::KeyInfoResolver* m_resolver; /** * Loads an entity into the cache for faster lookup. This includes @@ -91,15 +95,29 @@ namespace opensaml { * Clear the cache of known entities and groups. */ virtual void clearDescriptorIndex(); + + /** + * Returns true iff the Credential matches the criteria supplied, if any. + * + * @param cred Credential plus KeyDescriptor usage information + * @param criteria criteria for Credential selection + * @return true iff the Credential applies + */ + virtual bool matches( + const std::pair& cred, const xmltooling::CredentialCriteria* criteria + ) const; 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; + + mutable xmltooling::Mutex* m_credentialLock; + typedef std::map > > credmap_t; + mutable credmap_t m_credentialMap; + const credmap_t::mapped_type& resolveCredentials(const RoleDescriptor& role) const; }; };