Support for metadata mdfile type

This commit is contained in:
Roland Hedberg
2013-05-24 11:44:51 +02:00
parent ad4c338230
commit e1c30280fc
3 changed files with 118466 additions and 10356 deletions

File diff suppressed because one or more lines are too long

View File

@@ -6,7 +6,7 @@ from saml2.mdstore import MetadataStore
from saml2.mdstore import destinations from saml2.mdstore import destinations
from saml2.mdstore import name from saml2.mdstore import name
from saml2 import md from saml2 import md, sigver
from saml2 import BINDING_SOAP from saml2 import BINDING_SOAP
from saml2 import BINDING_HTTP_REDIRECT from saml2 import BINDING_HTTP_REDIRECT
from saml2 import BINDING_HTTP_POST from saml2 import BINDING_HTTP_POST
@@ -69,6 +69,9 @@ METADATACONF = {
}, },
"6": { "6": {
"local": [full_path("metasp.xml")] "local": [full_path("metasp.xml")]
},
"8": {
"mdfile": [full_path("swamid.md")]
} }
} }
@@ -236,5 +239,15 @@ def test_sp_metadata():
assert _eq([n["friendly_name"] for n in req["required"]], assert _eq([n["friendly_name"] for n in req["required"]],
['surName', 'givenName', 'mail']) ['surName', 'givenName', 'mail'])
def test_metadata_file():
sec_config.xmlsec_binary = sigver.get_xmlsec_binary(["/opt/local/bin"])
mds = MetadataStore(ONTS.values(), ATTRCONV, sec_config,
disable_ssl_certificate_validation=True)
mds.imp(METADATACONF["8"])
print len(mds.keys())
assert len(mds.keys()) == 560
if __name__ == "__main__": if __name__ == "__main__":
test_swami_1() test_metadata_file()

View File

@@ -18,14 +18,14 @@ def test_construct_0():
url = sp.create_discovery_service_request("http://example.com/saml/disco", url = sp.create_discovery_service_request("http://example.com/saml/disco",
"https://example.com/saml/sp.xml") "https://example.com/saml/sp.xml")
assert url == "http://example.com/saml/disco?entityID=https%3A%2F%2Fexample.com%2Fsaml%2Fsp.xml" assert url == "http://example.com/saml/disco?entityID=https%3A%2F%2Fexample.com%2Fsaml%2Fsp.xml"
def test_construct_1(): def test_construct_1():
sp = Saml2Client(config_file=dotname("servera_conf")) sp = Saml2Client(config_file=dotname("servera_conf"))
url = sp.create_discovery_service_request("http://example.com/saml/disco", url = sp.create_discovery_service_request("http://example.com/saml/disco",
"https://example.com/saml/sp.xml") "https://example.com/saml/sp.xml")
assert url == "http://example.com/saml/disco?entityID=https%3A%2F%2Fexample.com%2Fsaml%2Fsp.xml" assert url == "http://example.com/saml/disco?entityID=https%3A%2F%2Fexample.com%2Fsaml%2Fsp.xml"
def test_construct_deconstruct_request(): def test_construct_deconstruct_request():
sp = Saml2Client(config_file=dotname("servera_conf")) sp = Saml2Client(config_file=dotname("servera_conf"))