diff options
author | Johan Lundberg <lundberg@sunet.se> | 2019-12-16 15:07:09 +0100 |
---|---|---|
committer | Johan Lundberg <lundberg@sunet.se> | 2019-12-16 15:07:09 +0100 |
commit | f6d1c878be3f3a45bd963a3b45ddf92fb0d49f1e (patch) | |
tree | e8d8d378e587dd7e7967898d2bd97dafcb822ba8 /tests/test_30_mdstore.py | |
parent | e195bb96a908935e35ec7ff70dd0ef91d87e6fb0 (diff) | |
download | pysaml2-f6d1c878be3f3a45bd963a3b45ddf92fb0d49f1e.tar.gz |
Convenience method for getting supported algorithms from metadata
Diffstat (limited to 'tests/test_30_mdstore.py')
-rw-r--r-- | tests/test_30_mdstore.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_30_mdstore.py b/tests/test_30_mdstore.py index 630821db..c77293bb 100644 --- a/tests/test_30_mdstore.py +++ b/tests/test_30_mdstore.py @@ -54,6 +54,7 @@ TEST_METADATA_STRING = """ <EntitiesDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" + xmlns:alg="urn:oasis:names:tc:SAML:metadata:algsupport" xmlns:shibmeta="urn:mace:shibboleth:metadata:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" @@ -61,6 +62,10 @@ TEST_METADATA_STRING = """ <EntityDescriptor entityID="http://xenosmilus.umdc.umu.se/simplesaml/saml2/idp/metadata.php" xml:base="swamid-1.0/idp.umu.se-saml2.xml"> + <md:Extensions> + <alg:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> + <alg:SigningMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/> + </md:Extensions> <IDPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"> <KeyDescriptor> <ds:KeyInfo> @@ -488,6 +493,15 @@ def test_metadata_extension_algsupport(): assert mds +def test_supported_algorithms(): + mds = MetadataStore(ATTRCONV, sec_config, + disable_ssl_certificate_validation=True) + mds.imp(METADATACONF["11"]) + algs = mds.supported_algorithms(entity_id='http://xenosmilus.umdc.umu.se/simplesaml/saml2/idp/metadata.php') + assert 'http://www.w3.org/2001/04/xmlenc#sha256' in algs['digest_methods'] + assert 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256' in algs['signing_methods'] + + def test_extension(): mds = MetadataStore(ATTRCONV, None) # use ordered dict to force expected entity to be last |