diff options
Diffstat (limited to 'tests/test_64_artifact.py')
-rw-r--r-- | tests/test_64_artifact.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/test_64_artifact.py b/tests/test_64_artifact.py index f0220db4..65edaebe 100644 --- a/tests/test_64_artifact.py +++ b/tests/test_64_artifact.py @@ -2,10 +2,10 @@ import base64 from hashlib import sha1 from urlparse import urlparse from urlparse import parse_qs -from saml2.saml import AUTHN_PASSWORD from saml2 import BINDING_HTTP_ARTIFACT from saml2 import BINDING_SOAP from saml2 import BINDING_HTTP_POST +from saml2.authn_context import INTERNETPROTOCOLPASSWORD from saml2.client import Saml2Client from saml2.entity import create_artifact @@ -17,6 +17,13 @@ __author__ = 'rolandh' TAG1 = "name=\"SAMLRequest\" value=" + +AUTHN = { + "class_ref": INTERNETPROTOCOLPASSWORD, + "authn_auth": "http://www.example.com/login" +} + + def get_msg(hinfo, binding, response=False): if binding == BINDING_SOAP: msg = hinfo["data"] @@ -43,6 +50,7 @@ def get_msg(hinfo, binding, response=False): return msg + def test_create_artifact(): b64art = create_artifact("http://sp.example.com/saml.xml", "aabbccddeeffgghhiijj") @@ -57,6 +65,7 @@ def test_create_artifact(): SP = 'urn:mace:example.com:saml:roland:sp' + def test_create_artifact_resolve(): b64art = create_artifact(SP, "aabbccddeeffgghhiijj", 1) artifact = base64.b64decode(b64art) @@ -88,8 +97,9 @@ def test_create_artifact_resolve(): assert ar.artifact.text == b64art + def test_artifact_flow(): - SP = 'urn:mace:example.com:saml:roland:sp' + #SP = 'urn:mace:example.com:saml:roland:sp' sp = Saml2Client(config_file="servera_conf") idp = Server(config_file="idp_all_conf") @@ -164,8 +174,7 @@ def test_artifact_flow(): "mail": "derek.jeter@nyy.mlb.com", "title": "The man"}, name_id=name_id, - authn=(AUTHN_PASSWORD, - "http://www.example.com/login"), + authn=AUTHN, **resp_args) print response @@ -207,7 +216,7 @@ def test_artifact_flow(): assert ar.artifact.text == artifact3 # The IDP retrieves the response from the database using the artifact as the key - oreq = idp.artifact[ar.artifact.text] + #oreq = idp.artifact[ar.artifact.text] binding, destination = idp.pick_binding("artifact_resolution_service", entity_id=sp.config.entityid) |