[shibboleth-sp2] 73/82: SSPCPP-756 Flesh out Metadata Tests: regexFromFile
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 2619bcd4ed117389ac85e74b1c0c56f2297177b3
Author: Rod Widdowson <rdw at steadingsoftware.com>
Date: Fri Oct 6 16:10:25 2017 +0100
SSPCPP-756 Flesh out Metadata Tests: regexFromFile
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 | 1 +
Projects/vc15/UnitTests/UnitTests.vcxproj.filters | 3 ++
unittests/DynamicMetadataProviderTest.h | 28 ++++++++++++-
unittests/data/regexFromFile.xml | 3 ++
unittests/data/www.example.org.xml | 49 +++++++++++++++++++++++
5 files changed, 83 insertions(+), 1 deletion(-)
diff --git a/Projects/vc15/UnitTests/UnitTests.vcxproj b/Projects/vc15/UnitTests/UnitTests.vcxproj
index 7afc024..0ded90a 100644
--- a/Projects/vc15/UnitTests/UnitTests.vcxproj
+++ b/Projects/vc15/UnitTests/UnitTests.vcxproj
@@ -175,6 +175,7 @@
</ItemGroup>
<ItemGroup>
<Xml Include="..\..\..\unittests\data\templateFromFile.xml" />
+ <Xml Include="..\..\..\unittests\data\regexFromFile.xml" />
<Xml Include="..\..\..\unittests\data\templateFromRepo.xml" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
diff --git a/Projects/vc15/UnitTests/UnitTests.vcxproj.filters b/Projects/vc15/UnitTests/UnitTests.vcxproj.filters
index ffdcecc..987036a 100644
--- a/Projects/vc15/UnitTests/UnitTests.vcxproj.filters
+++ b/Projects/vc15/UnitTests/UnitTests.vcxproj.filters
@@ -40,5 +40,8 @@
<Xml Include="..\..\..\unittests\data\templateFromRepo.xml">
<Filter>Data</Filter>
</Xml>
+ <Xml Include="..\..\..\unittests\data\regexFromFile.xml">
+ <Filter>Data</Filter>
+ </Xml>
</ItemGroup>
</Project>
\ No newline at end of file
diff --git a/unittests/DynamicMetadataProviderTest.h b/unittests/DynamicMetadataProviderTest.h
index 980bd82..1da9a38 100644
--- a/unittests/DynamicMetadataProviderTest.h
+++ b/unittests/DynamicMetadataProviderTest.h
@@ -79,13 +79,39 @@ public:
);
try {
metadataProvider->init();
- pair<const EntityDescriptor*, const RoleDescriptor*> pair = metadataProvider->getEntityDescriptor(opensaml::saml2md::MetadataProvider::Criteria("https://www.example.org/sp"));
+ pair<const EntityDescriptor*, const RoleDescriptor*> thePair = metadataProvider->getEntityDescriptor(opensaml::saml2md::MetadataProvider::Criteria("https://www.example.org/sp"));
+ TS_ASSERT(nullptr != thePair.first);
+
} catch (XMLToolingException& ex) {
TS_TRACE(ex.what());
throw;
}
}
+ void testRegexFromFile()
+ {
+ string config = data_path + "regexFromFile.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*> thePair = metadataProvider->getEntityDescriptor(opensaml::saml2md::MetadataProvider::Criteria("https://www.example.org/sp"));
+ TS_ASSERT(nullptr != thePair.first);
+
+ } catch (XMLToolingException& ex) {
+ TS_TRACE(ex.what());
+ throw;
+ }
+ }
+
+
};
diff --git a/unittests/data/regexFromFile.xml b/unittests/data/regexFromFile.xml
new file mode 100644
index 0000000..8bd6554
--- /dev/null
+++ b/unittests/data/regexFromFile.xml
@@ -0,0 +1,3 @@
+<MetadataProvider type="Dynamic" ignoreTransport="true" >
+ <Regex match="^https?://([a-zA-Z0-9\\.]+).*$">file:///H:/Perforce/VS2017/cpp-sp/unittests/data/$1.xml</Regex>
+</MetadataProvider>
diff --git a/unittests/data/www.example.org.xml b/unittests/data/www.example.org.xml
new file mode 100644
index 0000000..7c37496
--- /dev/null
+++ b/unittests/data/www.example.org.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>
--
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