Multi-line svn commit, see body.
authorScott Cantor <cantor.2@osu.edu>
Thu, 13 Mar 2008 03:52:27 +0000 (03:52 +0000)
committerScott Cantor <cantor.2@osu.edu>
Thu, 13 Mar 2008 03:52:27 +0000 (03:52 +0000)
Add new builder base class to indicate support for "argument-less" construction.
Add "null" metadata provider.

.cproject
saml/Makefile.am
saml/saml.vcproj
saml/saml2/core/Assertions.h
saml/saml2/metadata/Metadata.h
saml/saml2/metadata/MetadataProvider.h
saml/saml2/metadata/impl/DynamicMetadataProvider.cpp
saml/saml2/metadata/impl/MetadataProvider.cpp
saml/saml2/metadata/impl/NullMetadataProvider.cpp [new file with mode: 0644]

index af2ae06..9d80abc 100644 (file)
--- a/.cproject
+++ b/.cproject
@@ -1,7 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<?fileVersion 4.0.0?>\r
-\r
-<cproject>\r
+<?xml version="1.0" encoding="UTF-8"?><?fileVersion 4.0.0?><cproject>\r
 <storageModule moduleId="org.eclipse.cdt.core.settings">\r
 <cconfiguration id="converted.config.2133715230">\r
 <storageModule moduleId="scannerConfiguration">\r
 <storageModule moduleId="org.eclipse.cdt.core.settings">\r
 <cconfiguration id="converted.config.2133715230">\r
 <storageModule moduleId="scannerConfiguration">\r
 </extensions>\r
 </storageModule>\r
 <storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>\r
 </extensions>\r
 </storageModule>\r
 <storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>\r
+\r
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>\r
 <storageModule moduleId="org.eclipse.cdt.core.pathentry">\r
 <storageModule moduleId="org.eclipse.cdt.core.pathentry">\r
+<pathentry kind="mac" name="_MSC_VER" path="" value=""/>\r
+<pathentry kind="mac" name="WIN32" path="" value=""/>\r
+<pathentry include="C:/xerces-c_2_8_0-x86-windows-vc_8_0/include" kind="inc" path="" system="true"/>\r
+<pathentry include="C:/xml-security-c-1.4.0/include" kind="inc" path="" system="true"/>\r
+<pathentry include="C:/log4shib-1.0/include" kind="inc" path="" system="true"/>\r
+<pathentry include="C:/cxxtest" kind="inc" path="" system="true"/>\r
 <pathentry kind="out" path=""/>\r
 <pathentry kind="out" path="debug"/>\r
 <pathentry kind="out" path="saml/Debug"/>\r
 <pathentry kind="out" path=""/>\r
 <pathentry kind="out" path="debug"/>\r
 <pathentry kind="out" path="saml/Debug"/>\r
 <pathentry kind="src" path="samltest/saml2/metadata"/>\r
 <pathentry kind="src" path="samltest/security"/>\r
 <pathentry kind="src" path="samltest/signature"/>\r
 <pathentry kind="src" path="samltest/saml2/metadata"/>\r
 <pathentry kind="src" path="samltest/security"/>\r
 <pathentry kind="src" path="samltest/signature"/>\r
-<pathentry kind="mac" name="_MSC_VER" path="" value=""/>\r
-<pathentry kind="mac" name="WIN32" path="" value=""/>\r
-<pathentry base-path="OpenSAML2-C" include="" kind="inc" path="" system="true"/>\r
-<pathentry base-path="OpenSAML2-C" include="saml" kind="inc" path="" system="true"/>\r
-<pathentry base-path="XMLTooling-C" include="" kind="inc" path="" system="true"/>\r
-<pathentry include="C:/xerces-c2_7_0-win32/include" kind="inc" path="" system="true"/>\r
-<pathentry include="C:/xml-security-c-1.2.0/include" kind="inc" path="" system="true"/>\r
-<pathentry include="C:/log4cpp-0.3.5rc1/include" kind="inc" path="" system="true"/>\r
-<pathentry include="C:/cxxtest" kind="inc" path="" system="true"/>\r
 <pathentry kind="src" path="samltest/encryption"/>\r
 <pathentry kind="src" path="samlsign"/>\r
 </storageModule>\r
 <pathentry kind="src" path="samltest/encryption"/>\r
 <pathentry kind="src" path="samlsign"/>\r
 </storageModule>\r
-<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>\r
 </cconfiguration>\r
 </storageModule>\r
 </cproject>\r
 </cconfiguration>\r
 </storageModule>\r
 </cproject>\r
index b8171ff..2ee7847 100644 (file)
@@ -142,6 +142,7 @@ libsaml_la_SOURCES = \
        saml2/metadata/impl/MetadataImpl.cpp \
        saml2/metadata/impl/MetadataProvider.cpp \
        saml2/metadata/impl/MetadataSchemaValidators.cpp \
        saml2/metadata/impl/MetadataImpl.cpp \
        saml2/metadata/impl/MetadataProvider.cpp \
        saml2/metadata/impl/MetadataSchemaValidators.cpp \
+       saml2/metadata/impl/NullMetadataProvider.cpp \
        saml2/metadata/impl/SignatureMetadataFilter.cpp \
        saml2/metadata/impl/WhitelistMetadataFilter.cpp \
        saml2/metadata/impl/XMLMetadataProvider.cpp \
        saml2/metadata/impl/SignatureMetadataFilter.cpp \
        saml2/metadata/impl/WhitelistMetadataFilter.cpp \
        saml2/metadata/impl/XMLMetadataProvider.cpp \
index efb495c..de99854 100644 (file)
                                                        >\r
                                                </File>\r
                                                <File\r
                                                        >\r
                                                </File>\r
                                                <File\r
+                                                       RelativePath=".\saml2\metadata\impl\NullMetadataProvider.cpp"\r
+                                                       >\r
+                                               </File>\r
+                                               <File\r
                                                        RelativePath=".\saml2\metadata\impl\SignatureMetadataFilter.cpp"\r
                                                        >\r
                                                </File>\r
                                                        RelativePath=".\saml2\metadata\impl\SignatureMetadataFilter.cpp"\r
                                                        >\r
                                                </File>\r
index 20c4503..91ac1fe 100644 (file)
@@ -457,7 +457,7 @@ namespace opensaml {
          * This is customized to return a SubjectConfirmationData element with an
          * xsi:type of KeyInfoConfirmationDataType.
          */
          * This is customized to return a SubjectConfirmationData element with an
          * xsi:type of KeyInfoConfirmationDataType.
          */
-        class SAML_API KeyInfoConfirmationDataTypeBuilder : public xmltooling::XMLObjectBuilder {
+        class SAML_API KeyInfoConfirmationDataTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
         public:
             virtual ~KeyInfoConfirmationDataTypeBuilder() {}
             /** Default builder. */
         public:
             virtual ~KeyInfoConfirmationDataTypeBuilder() {}
             /** Default builder. */
index 9691329..4ea5a5b 100644 (file)
@@ -619,7 +619,7 @@ namespace opensaml {
          * This is customized to return a RoleDescriptor element with an
          * xsi:type of AuthnQueryDescriptorType.
          */
          * This is customized to return a RoleDescriptor element with an
          * xsi:type of AuthnQueryDescriptorType.
          */
-        class SAML_API AuthnQueryDescriptorTypeBuilder : public xmltooling::XMLObjectBuilder {
+        class SAML_API AuthnQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
         public:
             virtual ~AuthnQueryDescriptorTypeBuilder() {}
             /** Default builder. */
         public:
             virtual ~AuthnQueryDescriptorTypeBuilder() {}
             /** Default builder. */
@@ -666,7 +666,7 @@ namespace opensaml {
          * This is customized to return a RoleDescriptor element with an
          * xsi:type of AttributeQueryDescriptorType.
          */
          * This is customized to return a RoleDescriptor element with an
          * xsi:type of AttributeQueryDescriptorType.
          */
-        class SAML_API AttributeQueryDescriptorTypeBuilder : public xmltooling::XMLObjectBuilder {
+        class SAML_API AttributeQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
         public:
             virtual ~AttributeQueryDescriptorTypeBuilder() {}
             /** Default builder. */
         public:
             virtual ~AttributeQueryDescriptorTypeBuilder() {}
             /** Default builder. */
@@ -713,7 +713,7 @@ namespace opensaml {
          * This is customized to return a RoleDescriptor element with an
          * xsi:type of AuthzDecisionQueryDescriptorType.
          */
          * This is customized to return a RoleDescriptor element with an
          * xsi:type of AuthzDecisionQueryDescriptorType.
          */
-        class SAML_API AuthzDecisionQueryDescriptorTypeBuilder : public xmltooling::XMLObjectBuilder {
+        class SAML_API AuthzDecisionQueryDescriptorTypeBuilder : public xmltooling::ConcreteXMLObjectBuilder {
         public:
             virtual ~AuthzDecisionQueryDescriptorTypeBuilder() {}
             /** Default builder. */
         public:
             virtual ~AuthzDecisionQueryDescriptorTypeBuilder() {}
             /** Default builder. */
index 483d05c..59f826a 100644 (file)
@@ -249,6 +249,9 @@ namespace opensaml {
         /** MetadataProvider that wraps a sequence of metadata providers. */
         #define CHAINING_METADATA_PROVIDER  "Chaining"
 
         /** MetadataProvider that wraps a sequence of metadata providers. */
         #define CHAINING_METADATA_PROVIDER  "Chaining"
 
+        /** 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);
     };
 };
         DECL_XMLTOOLING_EXCEPTION(MetadataException,SAML_EXCEPTIONAPI(SAML_API),opensaml::saml2md,xmltooling::XMLToolingException,Exceptions related to metadata use);
     };
 };
index 288dd12..835a2ed 100644 (file)
@@ -17,7 +17,7 @@
 /**
  * DynamicMetadataProvider.cpp
  * 
 /**
  * DynamicMetadataProvider.cpp
  * 
- * Base class for caching metadata providers.
+ * Simple implementation of a dynamic caching MetadataProvider.
  */
 
 #include "internal.h"
  */
 
 #include "internal.h"
index 969be5a..6c27a18 100644 (file)
@@ -40,6 +40,7 @@ namespace opensaml {
         SAML_DLLLOCAL PluginManager<MetadataProvider,string,const DOMElement*>::Factory XMLMetadataProviderFactory;
         SAML_DLLLOCAL PluginManager<MetadataProvider,string,const DOMElement*>::Factory DynamicMetadataProviderFactory;
         SAML_DLLLOCAL PluginManager<MetadataProvider,string,const DOMElement*>::Factory ChainingMetadataProviderFactory;
         SAML_DLLLOCAL PluginManager<MetadataProvider,string,const DOMElement*>::Factory XMLMetadataProviderFactory;
         SAML_DLLLOCAL PluginManager<MetadataProvider,string,const DOMElement*>::Factory DynamicMetadataProviderFactory;
         SAML_DLLLOCAL PluginManager<MetadataProvider,string,const DOMElement*>::Factory ChainingMetadataProviderFactory;
+        SAML_DLLLOCAL PluginManager<MetadataProvider,string,const DOMElement*>::Factory NullMetadataProviderFactory;
         SAML_DLLLOCAL PluginManager<MetadataFilter,string,const DOMElement*>::Factory BlacklistMetadataFilterFactory;
         SAML_DLLLOCAL PluginManager<MetadataFilter,string,const DOMElement*>::Factory WhitelistMetadataFilterFactory;
         SAML_DLLLOCAL PluginManager<MetadataFilter,string,const DOMElement*>::Factory SignatureMetadataFilterFactory;
         SAML_DLLLOCAL PluginManager<MetadataFilter,string,const DOMElement*>::Factory BlacklistMetadataFilterFactory;
         SAML_DLLLOCAL PluginManager<MetadataFilter,string,const DOMElement*>::Factory WhitelistMetadataFilterFactory;
         SAML_DLLLOCAL PluginManager<MetadataFilter,string,const DOMElement*>::Factory SignatureMetadataFilterFactory;
@@ -52,6 +53,7 @@ void SAML_API opensaml::saml2md::registerMetadataProviders()
     conf.MetadataProviderManager.registerFactory(XML_METADATA_PROVIDER, XMLMetadataProviderFactory);
     conf.MetadataProviderManager.registerFactory(DYNAMIC_METADATA_PROVIDER, DynamicMetadataProviderFactory);
     conf.MetadataProviderManager.registerFactory(CHAINING_METADATA_PROVIDER, ChainingMetadataProviderFactory);
     conf.MetadataProviderManager.registerFactory(XML_METADATA_PROVIDER, XMLMetadataProviderFactory);
     conf.MetadataProviderManager.registerFactory(DYNAMIC_METADATA_PROVIDER, DynamicMetadataProviderFactory);
     conf.MetadataProviderManager.registerFactory(CHAINING_METADATA_PROVIDER, ChainingMetadataProviderFactory);
+    conf.MetadataProviderManager.registerFactory(NULL_METADATA_PROVIDER, NullMetadataProviderFactory);
 }
 
 void SAML_API opensaml::saml2md::registerMetadataFilters()
 }
 
 void SAML_API opensaml::saml2md::registerMetadataFilters()
diff --git a/saml/saml2/metadata/impl/NullMetadataProvider.cpp b/saml/saml2/metadata/impl/NullMetadataProvider.cpp
new file mode 100644 (file)
index 0000000..c7c6ca2
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ *  Copyright 2001-2007 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
+ *
+ *     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.
+ */
+
+/**
+ * NullMetadataProvider.cpp
+ * 
+ * Dummy provider that returns an empty entity supporting any role.
+ */
+
+#include "internal.h"
+#include "saml2/metadata/Metadata.h"
+#include "saml2/metadata/DynamicMetadataProvider.h"
+
+#include <xmltooling/util/XMLHelper.h>
+
+using namespace opensaml::saml2md;
+using namespace xmltooling;
+using namespace std;
+
+namespace opensaml {
+    namespace saml2md {
+        class SAML_DLLLOCAL NullMetadataProvider : public DynamicMetadataProvider
+        {
+        public:
+            NullMetadataProvider(const DOMElement* e) : DynamicMetadataProvider(e), m_template(NULL) {
+                e = XMLHelper::getFirstChildElement(e, samlconstants::SAML20MD_NS, EntityDescriptor::LOCAL_NAME);
+                if (e)
+                    m_template = dynamic_cast<EntityDescriptor*>(XMLObjectBuilder::buildOneFromElement(const_cast<DOMElement*>(e)));
+            }
+
+            virtual ~NullMetadataProvider() {
+                delete m_template;
+            }
+
+        protected:
+            EntityDescriptor* resolve(const char* entityID) const;
+
+        private:
+            EntityDescriptor* m_template;
+        }; 
+
+        MetadataProvider* SAML_DLLLOCAL NullMetadataProviderFactory(const DOMElement* const & e)
+        {
+            return new NullMetadataProvider(e);
+        }
+    };
+};
+
+EntityDescriptor* NullMetadataProvider::resolve(const char* entityID) const
+{
+    // Resolving for us just means fabricating a new dummy element.
+    EntityDescriptor* entity = m_template ? m_template->cloneEntityDescriptor() : EntityDescriptorBuilder::buildEntityDescriptor();
+    auto_ptr_XMLCh temp(entityID);
+    entity->setEntityID(temp.get());
+    return entity;
+}