This file is indexed.

/usr/include/saml/saml2/metadata/MetadataProvider.h is in libsaml2-dev 2.5.3-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
/**
 * Licensed to the University Corporation for Advanced Internet
 * Development, Inc. (UCAID) under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.
 *
 * UCAID licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the
 * License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific
 * language governing permissions and limitations under the License.
 */

/**
 * @file saml/saml2/metadata/MetadataProvider.h
 *
 * Supplies an individual source of metadata.
 */

#ifndef __saml2_metadataprov_h__
#define __saml2_metadataprov_h__

#include <saml/base.h>

#include <vector>
#include <iostream>
#include <boost/ptr_container/ptr_vector.hpp>
#include <xmltooling/exceptions.h>
#include <xmltooling/security/CredentialResolver.h>

namespace xmltooling {
    class XMLTOOL_API QName;
    class XMLTOOL_API XMLObject;
};

namespace opensaml {

    class SAML_API SAMLArtifact;

    namespace saml2md {

        class SAML_API EntityDescriptor;
        class SAML_API EntitiesDescriptor;
        class SAML_API RoleDescriptor;
        class SAML_API MetadataCredentialResolver;
        class SAML_API MetadataFilter;
        class SAML_API MetadataFilterContext;

#if defined (_MSC_VER)
        #pragma warning( push )
        #pragma warning( disable : 4251 )
#endif

        /**
         * Supplies an individual source of metadata.
         *
         * The source can be a local file, remote service, or the result of a
         * dynamic lookup, can include local caching, etc. Providers
         * <strong>MUST</strong> be locked before any lookup operations.
         */
        class SAML_API MetadataProvider : public virtual xmltooling::CredentialResolver
        {
            MAKE_NONCOPYABLE(MetadataProvider);
        protected:
            /**
             * Constructor.
             *
             * If a DOM is supplied, a set of default logic will be used to identify
             * and build MetadataFilter plugins and install them into the provider.
             *
             * The following XML content is supported:
             *
             * <ul>
             *  <li>&lt;MetadataFilter&gt; elements with a type attribute and type-specific content
             *  <li>&lt;Exclude&gt; elements representing a BlacklistMetadataFilter
             *  <li>&lt;BlacklistMetadataFilter&gt; element containing &lt;Exclude&gt; elements
             *  <li>&lt;Include&gt; elements representing a WhitelistMetadataFilter
             *  <li>&lt;SignatureMetadataFilter&gt; element containing a &lt;KeyResolver&gt; element
             *  <li>&lt;WhitelistMetadataFilter&gt; element containing &lt;Include&gt; elements
             * </ul>
             *
             * XML namespaces are ignored in the processing of these elements.
             *
             * @param e DOM to supply configuration for provider
             */
            MetadataProvider(const xercesc::DOMElement* e=nullptr);

        public:
            /**
             * Destructor will delete any installed filters.
             */
            virtual ~MetadataProvider();

            /**
             * Returns an identifier for the provider for logging/status purposes.
             *
             * @return an identifier, or null
             */
            virtual const char* getId() const;

            /**
             * Adds a metadata filter to apply to any resolved metadata. Will not be applied
             * to metadata that is already loaded.
             *
             * @param newFilter metadata filter to add
             */
            virtual void addMetadataFilter(MetadataFilter* newFilter);

            /**
             * Removes a metadata filter. The caller must delete the filter if necessary.
             *
             * @param oldFilter metadata filter to remove
             * @return  the old filter
             */
            virtual MetadataFilter* removeMetadataFilter(MetadataFilter* oldFilter);

            /**
             * Sets a filtering context object for use by the filtering process.
             * <p>The object's lifetime must last for the duration of the lifetime
             * of the MetadataProvider.
             *
             * @param ctx   a context object
             */
            void setContext(const MetadataFilterContext* ctx);

            /**
             * Should be called after instantiating provider and adding filters, but before
             * performing any lookup operations. Allows the provider to defer initialization
             * processes that are likely to result in exceptions until after the provider is
             * safely created. Providers SHOULD perform as much processing as possible in
             * this method so as to report/log any errors that would affect later processing.
             */
            virtual void init()=0;

            /**
             * Generate an XML representation of the provider's status. The XML must be
             * well-formed, but is otherwise arbitrary.
             *
             * @param os    stream to write status information to
             */
            virtual void outputStatus(std::ostream& os) const;

            /**
             * Gets the entire metadata tree, after the registered filter has been applied.
             * The caller MUST unlock the provider when finished with the data.
             *
             * @return the entire metadata tree
             */
            virtual const xmltooling::XMLObject* getMetadata() const=0;

            /**
             * Gets the metadata for a given group of entities. If a valid group is returned,
             * the resolver will be left in a locked state. The caller MUST unlock the
             * resolver when finished with the group.
             *
             * @param name                  the name of the group
             * @param requireValidMetadata  indicates whether the metadata for the group must be valid/current
             *
             * @return the group's metadata or nullptr if there is no metadata or no valid metadata
             */
            virtual const EntitiesDescriptor* getEntitiesDescriptor(const XMLCh* name, bool requireValidMetadata=true) const;

            /**
             * Gets the metadata for a given group of entities. If a valid group is returned,
             * the resolver will be left in a locked state. The caller MUST unlock the
             * resolver when finished with the group.
             *
             * @param name                  the name of the group
             * @param requireValidMetadata  indicates whether the metadata for the group must be valid/current
             *
             * @return the group's metadata or nullptr if there is no metadata or no valid metadata
             */
            virtual const EntitiesDescriptor* getEntitiesDescriptor(const char* name, bool requireValidMetadata=true) const=0;

            /**
             * Batches up criteria for entity lookup.
             */
            struct SAML_API Criteria {
                /**
                 * Default constructor.
                 */
                Criteria();

                /**
                 * Constructor.
                 *
                 * @param id    entityID to lookup
                 * @param q     element/type of role, if any
                 * @param prot  protocol support constant, if any
                 * @param valid true iff stale metadata should be ignored
                 */
                Criteria(const XMLCh* id, const xmltooling::QName* q=nullptr, const XMLCh* prot=nullptr, bool valid=true);

                /**
                 * Constructor.
                 *
                 * @param id    entityID to lookup
                 * @param q     element/type of role, if any
                 * @param prot  protocol support constant, if any
                 * @param valid true iff stale metadata should be ignored
                 */
                Criteria(const char* id, const xmltooling::QName* q=nullptr, const XMLCh* prot=nullptr, bool valid=true);

                /**
                 * Constructor.
                 *
                 * @param a     artifact to lookup
                 * @param q     element/type of role, if any
                 * @param prot  protocol support constant, if any
                 * @param valid true iff stale metadata should be ignored
                 */
                Criteria(const SAMLArtifact* a, const xmltooling::QName* q=nullptr, const XMLCh* prot=nullptr, bool valid=true);

                virtual ~Criteria();

                /**
                 * Restores the object to its default state.
                 */
                virtual void reset();

                /** Unique ID of entity. */
                const XMLCh* entityID_unicode;
                /** Unique ID of entity. */
                const char* entityID_ascii;
                /** SAML artifact */
                const SAMLArtifact* artifact;
                /** Element or schema type QName of metadata role. */
                const xmltooling::QName* role;
                /** Protocol support constant. */
                const XMLCh* protocol;
                /** Backup protocol support constant. */
                const XMLCh* protocol2;
                /** Controls whether stale metadata is ignored. */
                bool validOnly;
            };

            /**
             * Gets entity metadata based on supplied criteria. If a valid entity is returned,
             * the provider will be left in a locked state. The caller MUST unlock the
             * provider when finished with the entity.
             *
             * @param criteria  lookup criteria
             *
             * @return the entity's metadata (and optionally a role) or nullptr if there is no qualifying metadata
             */
            virtual std::pair<const EntityDescriptor*,const RoleDescriptor*> getEntityDescriptor(const Criteria& criteria) const=0;

        protected:
            /**
             * Applies any installed filters to a metadata instance.
             *
             * @param xmlObject the metadata to be filtered
             */
            void doFilters(xmltooling::XMLObject& xmlObject) const;

        private:
            const MetadataFilterContext* m_filterContext;
            boost::ptr_vector<MetadataFilter> m_filters;
        };

#if defined (_MSC_VER)
        #pragma warning( pop )
#endif

        /**
         * Registers MetadataProvider classes into the runtime.
         */
        void SAML_API registerMetadataProviders();

        /** MetadataProvider based on local or remote XML file */
        #define XML_METADATA_PROVIDER  "XML"

        /** MetadataProvider based on dynamic resolution */
        #define DYNAMIC_METADATA_PROVIDER  "Dynamic"

        /** MetadataProvider that wraps a sequence of metadata providers. */
        #define CHAINING_METADATA_PROVIDER  "Chaining"

        /** MetadataProvider that loads a directory of files. */
        #define FOLDER_METADATA_PROVIDER  "Folder"

        /** MetadataProvider that returns an empty "dummy" entity descriptor. */
        #define NULL_METADATA_PROVIDER  "Null"

        DECL_XMLTOOLING_EXCEPTION(MetadataException,SAML_EXCEPTIONAPI(SAML_API),opensaml::saml2md,xmltooling::XMLToolingException,Exceptions related to metadata use);
    };
};

#endif /* __saml2_metadataprov_h__ */