https://issues.shibboleth.net/jira/browse/SSPCPP-254
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / DiscoverableMetadataProvider.h
1 /*
2  *  Copyright 2010 Internet2
3  * 
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 /**
18  * @file saml/saml2/metadata/DiscoverableMetadataProvider.h
19  * 
20  * A metadata provider that provides a JSON feed of IdP discovery information.
21  */
22
23 #ifndef __saml2_discometadataprov_h__
24 #define __saml2_discometadataprov_h__
25
26 #include <saml/saml2/metadata/MetadataProvider.h>
27
28 namespace opensaml {
29     
30     namespace saml2md {
31         
32 #if defined (_MSC_VER)
33         #pragma warning( push )
34         #pragma warning( disable : 4251 )
35 #endif
36         /**
37          * A metadata provider that provides a JSON feed of IdP discovery information.
38          */
39         class SAML_API DiscoverableMetadataProvider : public virtual MetadataProvider
40         {
41         protected:
42             DiscoverableMetadataProvider();
43             
44             /**
45              * Generates a JSON feed of IdP discovery information for the current metadata.
46              * <p>The provider <strong>MUST</strong> be write-locked.
47              */
48             virtual void generateFeed();
49
50         public:
51             virtual ~DiscoverableMetadataProvider();
52
53             /**
54              * Returns the ETag associated with the cached feed.
55              * <p>The provider <strong>MUST</strong> be locked.
56              *
57              * @return the ETag value for the current feed state
58              */
59             virtual std::string getCacheTag() const;
60
61             /**
62              * Outputs the cached feed.
63              * <p>The provider <strong>MUST</strong> be locked.
64              *
65              * @param os    stream to output feed into
66              * @return a reference to the output stream
67              */
68             virtual std::ostream& outputFeed(std::ostream& os) const;
69
70         protected:
71             /** Storage for feed. */
72             std::string m_feed;
73
74             /** ETag for feed. */
75             mutable std::string m_feedTag;
76         };
77
78 #if defined (_MSC_VER)
79         #pragma warning( pop )
80 #endif
81
82     };
83 };
84
85 #endif /* __saml2_discometadataprov_h__ */