2 * Licensed to the University Corporation for Advanced Internet
3 * Development, Inc. (UCAID) under one or more contributor license
4 * agreements. See the NOTICE file distributed with this work for
5 * additional information regarding copyright ownership.
7 * UCAID licenses this file to you under the Apache License,
8 * Version 2.0 (the "License"); you may not use this file except
9 * in compliance with the License. You may obtain a copy of the
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17 * either express or implied. See the License for the specific
18 * language governing permissions and limitations under the License.
22 * @file saml/saml2/metadata/DiscoverableMetadataProvider.h
24 * A metadata provider that provides a JSON feed of IdP discovery information.
27 #ifndef __saml2_discometadataprov_h__
28 #define __saml2_discometadataprov_h__
30 #include <saml/saml2/metadata/MetadataProvider.h>
36 #if defined (_MSC_VER)
37 #pragma warning( push )
38 #pragma warning( disable : 4251 )
41 * A metadata provider that provides a JSON feed of IdP discovery information.
43 class SAML_API DiscoverableMetadataProvider : public virtual MetadataProvider
49 * If a DOM is supplied, the following XML content is supported:
52 * <dt>legacyOrgNames</dt>
53 * <dd>true iff IdPs without a UIInfo extension should
54 * be identified using <md:OrganizationDisplayName></dd>
57 * @param e DOM to supply configuration for provider
59 DiscoverableMetadataProvider(const xercesc::DOMElement* e=nullptr);
62 * Generates a JSON feed of IdP discovery information for the current metadata.
63 * <p>The provider <strong>MUST</strong> be write-locked.
65 virtual void generateFeed();
68 virtual ~DiscoverableMetadataProvider();
71 * Returns the ETag associated with the cached feed.
72 * <p>The provider <strong>MUST</strong> be locked.
74 * @return the ETag value for the current feed state
76 virtual std::string getCacheTag() const;
79 * Outputs the cached feed.
80 * <p>The provider <strong>MUST</strong> be locked.
82 * @param os stream to output feed into
83 * @param first on input, indicates if the feed is first in position,
84 * on output will be false if the feed was non-empty
85 * @param wrapArray true iff the feed array should be opened/closed by this provider
87 virtual void outputFeed(std::ostream& os, bool& first, bool wrapArray=true) const;
90 /** Storage for feed. */
94 mutable std::string m_feedTag;
97 void discoEntity(std::string& s, const EntityDescriptor* entity, bool& first) const;
98 void discoGroup(std::string& s, const EntitiesDescriptor* group, bool& first) const;
100 bool m_legacyOrgNames;
103 #if defined (_MSC_VER)
104 #pragma warning( pop )
110 #endif /* __saml2_discometadataprov_h__ */