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