[shibboleth-sp2] 72/82: SSPCPP-756 Flesh out Metadata Tests: templateFromRepo

Etienne Dysli Metref edm-guest at moszumanska.debian.org
Thu Nov 16 08:16:27 UTC 2017


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

edm-guest pushed a commit to branch master
in repository shibboleth-sp2.

commit 9cbabe2efa531513e40d8dde1b01b660f099018c
Author: Rod Widdowson <rdw at steadingsoftware.com>
Date:   Fri Oct 6 15:15:13 2017 +0100

    SSPCPP-756 Flesh out Metadata Tests: templateFromRepo
    
    https://issues.shibboleth.net/jira/browse/SSPCPP-756
    
    This requires manual editing of the source file because we cannot
    inject relative names.
---
 Projects/vc15/UnitTests/UnitTests.vcxproj          |  3 +-
 Projects/vc15/UnitTests/UnitTests.vcxproj.filters  |  5 ++-
 unittests/DynamicMetadataProviderTest.h            | 22 ++++++++++
 .../08ced64cddc9f1578598b2cf71ae747b11d11472.xml   | 49 ++++++++++++++++++++++
 unittests/data/templateFromFile.xml                |  3 ++
 5 files changed, 80 insertions(+), 2 deletions(-)

diff --git a/Projects/vc15/UnitTests/UnitTests.vcxproj b/Projects/vc15/UnitTests/UnitTests.vcxproj
index e2a16b4..7afc024 100644
--- a/Projects/vc15/UnitTests/UnitTests.vcxproj
+++ b/Projects/vc15/UnitTests/UnitTests.vcxproj
@@ -174,7 +174,8 @@
     <ClCompile Include="..\..\..\Build\VC15\UnitTests\x64\Debug\SPTest.cpp" />
   </ItemGroup>
   <ItemGroup>
-    <Xml Include="..\..\..\unittests\data\DynamicMetadataProvider.xml" />
+    <Xml Include="..\..\..\unittests\data\templateFromFile.xml" />
+    <Xml Include="..\..\..\unittests\data\templateFromRepo.xml" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
diff --git a/Projects/vc15/UnitTests/UnitTests.vcxproj.filters b/Projects/vc15/UnitTests/UnitTests.vcxproj.filters
index 362c3bd..ffdcecc 100644
--- a/Projects/vc15/UnitTests/UnitTests.vcxproj.filters
+++ b/Projects/vc15/UnitTests/UnitTests.vcxproj.filters
@@ -34,7 +34,10 @@
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <Xml Include="..\..\..\unittests\data\DynamicMetadataProvider.xml">
+    <Xml Include="..\..\..\unittests\data\templateFromFile.xml">
+      <Filter>Data</Filter>
+    </Xml>
+    <Xml Include="..\..\..\unittests\data\templateFromRepo.xml">
       <Filter>Data</Filter>
     </Xml>
   </ItemGroup>
diff --git a/unittests/DynamicMetadataProviderTest.h b/unittests/DynamicMetadataProviderTest.h
index 4ab9662..980bd82 100644
--- a/unittests/DynamicMetadataProviderTest.h
+++ b/unittests/DynamicMetadataProviderTest.h
@@ -65,6 +65,28 @@ public:
         }
     }
 
+    void testTemplateFromFile()
+    {
+        string config = data_path + "templateFromFile.xml";
+        ifstream in(config.c_str());
+        XMLToolingConfig& xcf = XMLToolingConfig::getConfig();
+        ParserPool& pool = xcf.getParser();
+        DOMDocument* doc = pool.parse(in);
+        XercesJanitor<DOMDocument> janitor(doc);
+
+        auto_ptr<MetadataProvider> metadataProvider(
+            opensaml::SAMLConfig::getConfig().MetadataProviderManager.newPlugin(DYNAMIC_METADATA_PROVIDER, doc->getDocumentElement())
+        );
+        try {
+            metadataProvider->init();
+            pair<const EntityDescriptor*, const RoleDescriptor*>  pair = metadataProvider->getEntityDescriptor(opensaml::saml2md::MetadataProvider::Criteria("https://www.example.org/sp"));
+        } catch (XMLToolingException& ex) {
+            TS_TRACE(ex.what());
+            throw;
+        }
+    }
+
+
 };
 
 
diff --git a/unittests/data/08ced64cddc9f1578598b2cf71ae747b11d11472.xml b/unittests/data/08ced64cddc9f1578598b2cf71ae747b11d11472.xml
new file mode 100644
index 0000000..7c37496
--- /dev/null
+++ b/unittests/data/08ced64cddc9f1578598b2cf71ae747b11d11472.xml
@@ -0,0 +1,49 @@
+<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" ID="_a3623fbbcb6af813c50b67a828668b1e55ae2c0f" entityID="https://www.example.org/sp">
+
+  <md:SPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol urn:oasis:names:tc:SAML:1.1:protocol urn:oasis:names:tc:SAML:1.0:protocol">
+    <md:Extensions>
+      <init:RequestInitiator xmlns:init="urn:oasis:names:tc:SAML:profiles:SSO:request-init" Binding="urn:oasis:names:tc:SAML:profiles:SSO:request-init" Location="https://www.example.org/Shibboleth.sso/Login"/>
+      <idpdisc:DiscoveryResponse xmlns:idpdisc="urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol" Binding="urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol" Location="https://www.example.org/Shibboleth.sso/Login" index="1"/>
+    </md:Extensions>
+    <md:KeyDescriptor>
+      <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+        <ds:KeyName>https://www.example.org/shibboleth</ds:KeyName>
+        <ds:KeyName>www.example.org</ds:KeyName>
+        <ds:X509Data>
+          <ds:X509SubjectName>CN=www.example.org</ds:X509SubjectName>
+          <ds:X509Certificate>MIIDRDCCAiygAwIBAgIJAIc3DausM4oaMA0GCSqGSIb3DQEBBQUAMCUxIzAhBgNV
+BAMTGnd3dy5saWJyYXJ5Lmdlb3JnZXRvd24uZWR1MB4XDTEyMDgwOTIxMjIwNFoX
+DTMyMDgwNDIxMjIwNFowJTEjMCEGA1UEAxMad3d3LmxpYnJhcnkuZ2VvcmdldG93
+bi5lZHUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkc0sA/9cehYrs
+AR8nT0Me8JcKIFeFZlAi9jp0vhvsF8tbbhq9diZjaCeww93yfeDPC9u9wi6ya40x
+gkLHLeBinYJlDruk84QLrRImQ1di4rJQgBBt/wLr+wZQgeuo/P+es0ox9VU+fBqr
+xQRHvenkw/LKPuCz7mkhotZt/zy0UnNcq5o5t6tsZLU+BbSUWoBoB3MQXzN/PjMq
+ROks9/v90HtUCiF9J7hPDpxLLJ7qkvJ+YpfuBcQB5NevoDv423cwwfkJGBJAu3Do
+Qs2vWOfS3AwDh8Cee43wjZB5eD44y+cVIeed16WehDKnXQ+DEcKnHzxF6IRMU+d1
+4kLs+QZHAgMBAAGjdzB1MFQGA1UdEQRNMEuCGnd3dy5saWJyYXJ5Lmdlb3JnZXRv
+d24uZWR1hi1odHRwczovL3d3dy5saWJyYXJ5Lmdlb3JnZXRvd24uZWR1L3NoaWJi
+b2xldGgwHQYDVR0OBBYEFO1vnaFkb0y5fLvOjUVlqDwIOWphMA0GCSqGSIb3DQEB
+BQUAA4IBAQDBEJbbxyd3IH5Kc6ZPNEJmSNEau5AeTeU3YNv5+I7OhpWbVjxtITTy
++IOnd8s8+1YbcwFJRsPQXc+uboTiVF9B+CHlJQ+mwgUH1ePBVG9PUwaRrX0my88c
+XEQptBIVdUqaNwuBBMQzUr2/UZK6EaStRor/yRrEgZNnPUFWtsW+sCG406gGbcxU
+93RurxLa4Cv0sE+SEFMkQnnmAN7odx6qM/1I1TCQPN0t4JfWjmhj8Iez0lnGMQPh
+NWevYWCdgIDPlYhhvJ9gnHu8JOfFRlZCXpc2p+x7Nsrudb+5Hhs7x93xciVyrttQ
+Iul4vX+c2dQrUz0m7rJ8tdZDwyQvUvwd
+</ds:X509Certificate>
+        </ds:X509Data>
+      </ds:KeyInfo>
+    </md:KeyDescriptor>
+    <md:ArtifactResolutionService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP" Location="https://www.example.org/Shibboleth.sso/Artifact/SOAP" index="0"/>
+    <md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP" Location="https://www.example.org/Shibboleth.sso/SLO/SOAP"/>
+    <md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="https://www.example.org/Shibboleth.sso/SLO/Redirect"/>
+    <md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://www.example.org/Shibboleth.sso/SLO/POST"/>
+    <md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact" Location="https://www.example.org/Shibboleth.sso/SLO/Artifact"/>
+    <md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://www.example.org/Shibboleth.sso/SAML2/POST" index="0"/>
+    <md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST-SimpleSign" Location="https://www.example.org/Shibboleth.sso/SAML2/POST-SimpleSign" index="1"/>
+    <md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact" Location="https://www.example.org/Shibboleth.sso/SAML2/Artifact" index="2"/>
+    <md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS" Location="https://www.example.org/Shibboleth.sso/SAML2/ECP" index="3"/>
+    <md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:1.0:profiles:browser-post" Location="https://www.example.org/Shibboleth.sso/SAML/POST" index="4"/>
+    <md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:1.0:profiles:artifact-01" Location="https://www.example.org/Shibboleth.sso/SAML/Artifact" index="5"/>
+  </md:SPSSODescriptor>
+
+</md:EntityDescriptor>
diff --git a/unittests/data/templateFromFile.xml b/unittests/data/templateFromFile.xml
new file mode 100644
index 0000000..bfedd58
--- /dev/null
+++ b/unittests/data/templateFromFile.xml
@@ -0,0 +1,3 @@
+<MetadataProvider type="Dynamic" ignoreTransport="true" >
+<Subst hashed="SHA1">file:///H:/Perforce/VS2017/cpp-sp/unittests/data/$entityID.xml</Subst>
+</MetadataProvider>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-shibboleth/shibboleth-sp2.git



More information about the Pkg-shibboleth-devel mailing list