Change license header, remove stale pkg files.
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / DiscoverableMetadataProvider.h
index a9bdb5a..a8f4e7b 100644 (file)
@@ -1,17 +1,21 @@
-/*
- *  Copyright 2010 Internet2
- * 
- * Licensed 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
+/**
+ * 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
+ * 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.
+ * 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.
  */
 
 /**
@@ -39,7 +43,20 @@ namespace opensaml {
         class SAML_API DiscoverableMetadataProvider : public virtual MetadataProvider
         {
         protected:
-            DiscoverableMetadataProvider();
+            /**
+             * Constructor.
+             *
+             * If a DOM is supplied, the following XML content is supported:
+             *
+             * <dl>
+             *   <dt>legacyOrgNames</dt>
+             *   <dd>true iff IdPs without a UIInfo extension should
+             *      be identified using &lt;md:OrganizationDisplayName&gt;</dd>
+             * </dl>
+             *
+             * @param e DOM to supply configuration for provider
+             */
+            DiscoverableMetadataProvider(const xercesc::DOMElement* e=nullptr);
             
             /**
              * Generates a JSON feed of IdP discovery information for the current metadata.
@@ -62,10 +79,12 @@ namespace opensaml {
              * Outputs the cached feed.
              * <p>The provider <strong>MUST</strong> be locked.
              *
-             * @param os    stream to output feed into
-             * @return a reference to the output stream
+             * @param os        stream to output feed into
+             * @param first     on input, indicates if the feed is first in position,
+             *                  on output will be false if the feed was non-empty
+             * @param wrapArray true iff the feed array should be opened/closed by this provider
              */
-            virtual std::ostream& outputFeed(std::ostream& os) const;
+            virtual void outputFeed(std::ostream& os, bool& first, bool wrapArray=true) const;
 
         protected:
             /** Storage for feed. */
@@ -73,6 +92,12 @@ namespace opensaml {
 
             /** ETag for feed. */
             mutable std::string m_feedTag;
+
+        private:
+            void disco(std::string& s, const EntityDescriptor* entity, bool& first) const;
+            void disco(std::string& s, const EntitiesDescriptor* group, bool& first) const;
+
+            bool m_legacyOrgNames;
         };
 
 #if defined (_MSC_VER)