[cpp-opensaml] branch master updated: SSPCPP-756 Add explicit bad signature test for XML Metadata Provider

Rod Widdowson rdw at steadingsoftware.com
Fri Jan 12 08:28:35 EST 2018


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository cpp-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-opensaml.git;a=commit;h=942a37bc41f3e023c88acddd91cc88d955ff76f5

The following commit(s) were added to refs/heads/master by this push:
       new  942a37b   SSPCPP-756  Add explicit bad signature test for XML Metadata Provider
942a37b is described below

commit 942a37bc41f3e023c88acddd91cc88d955ff76f5
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri Jan 12 13:06:19 2018 +0000

    SSPCPP-756  Add explicit bad signature test for XML Metadata Provider
    
    https://issues.shibboleth.net/jira/browse/SSPCPP-756
---
 .../saml2/metadata/XMLMetadataProviderBadSig.xml   | 10 +++++++++
 samltest/saml2/metadata/XMLMetadataProviderTest.h  | 24 ++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/samltest/data/saml2/metadata/XMLMetadataProviderBadSig.xml b/samltest/data/saml2/metadata/XMLMetadataProviderBadSig.xml
new file mode 100644
index 0000000..7f62c63
--- /dev/null
+++ b/samltest/data/saml2/metadata/XMLMetadataProviderBadSig.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<FilesystemMetadataProvider path="../../../samltest/data/saml2/metadata/InCommon-metadata.xml" validate="0">
+    <SignatureMetadataFilter>
+        <CredentialResolver type="File">
+            <Certificate>
+                <Path>../../../samltest/data/cert.pem</Path>
+            </Certificate>
+        </CredentialResolver>
+    </SignatureMetadataFilter>
+</FilesystemMetadataProvider>
diff --git a/samltest/saml2/metadata/XMLMetadataProviderTest.h b/samltest/saml2/metadata/XMLMetadataProviderTest.h
index e98ef4d..a14e5fe 100644
--- a/samltest/saml2/metadata/XMLMetadataProviderTest.h
+++ b/samltest/saml2/metadata/XMLMetadataProviderTest.h
@@ -23,6 +23,7 @@
 #include <saml/saml2/binding/SAML2ArtifactType0004.h>
 #include <saml/saml2/metadata/Metadata.h>
 #include <saml/saml2/metadata/MetadataProvider.h>
+#include <saml/saml2/metadata/MetadataFilter.h>
 #include <xmltooling/security/SecurityHelper.h>
 
 using namespace opensaml::saml2md;
@@ -52,6 +53,28 @@ public:
         SAMLObjectBaseTestCase::tearDown();
     }
 
+    void testBadSig()
+    {
+        string config = data_path + "saml2/metadata/XMLMetadataProviderBadSig.xml";
+        ifstream in(config.c_str());
+        DOMDocument* doc=XMLToolingConfig::getConfig().getParser().parse(in);
+        XercesJanitor<DOMDocument> janitor(doc);
+
+        auto_ptr<MetadataProvider> metadataProvider(SAMLConfig::getConfig().MetadataProviderManager.newPlugin(XML_METADATA_PROVIDER,
+                                                                                                              doc->getDocumentElement())
+        );
+        try {
+            metadataProvider->init();
+        } catch (MetadataFilterException& ex) {
+            TS_TRACE(ex.what());
+            return;
+        }
+        catch (XMLToolingException& ex) {
+            TS_TRACE(ex.what());
+            throw;
+        }
+    }
+
     void testXMLProvider() {
         string config = data_path + "saml2/metadata/XMLMetadataProvider.xml";
         ifstream in(config.c_str());
@@ -93,6 +116,7 @@ public:
         assertEquals("Entity's ID does not match requested ID", entityID, descriptor->getEntityID());
     }
 
+
     void testHTTPProvider()
     {
         string config = data_path + "saml2/metadata/HTTPMetadataProvider.xml";

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list