2 * Copyright 2001-2006 Internet2
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @file saml/security/ChainingMetadataProvider.h
20 * MetadataProvider that uses multiple providers in sequence.
23 #ifndef __saml_chainmeta_h__
24 #define __saml_chainmeta_h__
26 #include <saml/saml2/metadata/ObservableMetadataProvider.h>
27 #include <xmltooling/util/Threads.h>
33 * MetadataProvider that uses multiple providers in sequence.
35 class SAML_API ChainingMetadataProvider
36 : public ObservableMetadataProvider, public ObservableMetadataProvider::Observer {
41 * If a DOM is supplied, the following XML content is supported:
44 * <li><MetadataProvider> elements with a type attribute
47 * XML namespaces are ignored in the processing of this content.
49 * @param e DOM to supply configuration for provider
51 ChainingMetadataProvider(const DOMElement* e=NULL);
54 * Destructor will delete any embedded engines.
56 virtual ~ChainingMetadataProvider();
59 * Adds a provider for future calls. The provider <strong>MUST</strong> be
60 * initialized before adding it.
62 * @param newProvider provider to add
64 void addMetadataProvider(MetadataProvider* newProvider) {
65 m_providers.push_back(newProvider);
69 * Removes a provider. The caller must delete the provider if necessary.
71 * @param oldProvider provider to remove
72 * @return the old provider
74 MetadataProvider* removeMetadataProvider(MetadataProvider* oldProvider) {
75 for (std::vector<MetadataProvider*>::iterator i=m_providers.begin(); i!=m_providers.end(); i++) {
76 if (oldProvider==(*i)) {
84 xmltooling::Lockable* lock();
87 const xmlsignature::KeyResolver* getKeyResolver() const;
88 const xmltooling::XMLObject* getMetadata() const;
89 const EntitiesDescriptor* getEntitiesDescriptor(const char* name, bool requireValidMetadata=true) const;
90 const EntityDescriptor* getEntityDescriptor(const char* id, bool requireValidMetadata=true) const;
91 const EntityDescriptor* getEntityDescriptor(const SAMLArtifact* artifact) const;
92 void onEvent(MetadataProvider& provider);
95 xmltooling::ThreadKey* m_tlsKey;
96 std::vector<MetadataProvider*> m_providers;
101 #endif /* __saml_chainmeta_h__ */