Пример #1
0
def test_create_artifact_resolve():
    b64art = create_artifact(SP, "aabbccddeeffgghhiijj", 1)
    artifact = base64.b64decode(b64art)

    #assert artifact[:2] == '\x00\x04'
    #assert int(artifact[2:4]) == 0
    #
    s = sha1(SP)
    assert artifact[4:24] == s.digest()

    idp = Server(config_file="idp_all_conf")

    typecode = artifact[:2]
    assert typecode == ARTIFACT_TYPECODE

    destination = idp.artifact2destination(b64art, "spsso")

    msg = idp.create_artifact_resolve(b64art, destination, sid())

    print msg

    args = idp.use_soap(msg, destination, None, False)

    sp = Saml2Client(config_file="servera_conf")

    ar = sp.parse_artifact_resolve(args["data"])

    print ar

    assert ar.artifact.text == b64art
Пример #2
0
def test_create_artifact_resolve():
    b64art = create_artifact(SP, "aabbccddeeffgghhiijj", 1)
    artifact = base64.b64decode(b64art)

    #assert artifact[:2] == '\x00\x04'
    #assert int(artifact[2:4]) == 0
    #
    s = sha1(SP.encode('ascii'))
    assert artifact[4:24] == s.digest()

    with closing(Server(config_file="idp_all_conf")) as idp:
        typecode = artifact[:2]
        assert typecode == ARTIFACT_TYPECODE

        destination = idp.artifact2destination(b64art, "spsso")

        msg_id, msg = idp.create_artifact_resolve(b64art, destination, sid())

        print(msg)

        args = idp.use_soap(msg, destination, None, False)

        sp = Saml2Client(config_file="servera_conf")

        ar = sp.parse_artifact_resolve(args["data"])

        print(ar)

        assert ar.artifact.text == b64art
Пример #3
0
def test_create_artifact():
    b64art = create_artifact("http://sp.example.com/saml.xml",
                             b"aabbccddeeffgghhiijj")

    art = base64.b64decode(b64art.encode('ascii'))

    assert art[:2] == ARTIFACT_TYPECODE
    assert int(art[2:4]) == 0

    s = sha1(b"http://sp.example.com/saml.xml")
    assert art[4:24] == s.digest()
Пример #4
0
def test_create_artifact():
    b64art = create_artifact("http://sp.example.com/saml.xml",
                             "aabbccddeeffgghhiijj")

    art = base64.b64decode(b64art)

    assert art[:2] == '\x00\x04'
    assert int(art[2:4]) == 0

    s = sha1("http://sp.example.com/saml.xml")
    assert art[4:24] == s.digest()
Пример #5
0
def test_create_artifact():
    b64art = create_artifact("http://sp.example.com/saml.xml",
                             "aabbccddeeffgghhiijj")

    art = base64.b64decode(b64art)

    assert art[:2] == '\x00\x04'
    assert int(art[2:4]) == 0

    s = sha1("http://sp.example.com/saml.xml")
    assert art[4:24] == s.digest()
Пример #6
0
def test_create_artifact():
    b64art = create_artifact("http://sp.example.com/saml.xml",
                             b"aabbccddeeffgghhiijj")

    art = base64.b64decode(b64art.encode('ascii'))

    assert art[:2] == ARTIFACT_TYPECODE
    assert int(art[2:4]) == 0

    s = sha1(b"http://sp.example.com/saml.xml")
    assert art[4:24] == s.digest()
Пример #7
0
def test_create_artifact():
    b64art = create_artifact("http://sp.example.com/saml.xml",
                             "aabbccddeeffgghhiijj")

    art = base64.b64decode(b64art)

    assert art[:2] == b'\x00\x04'
    assert art[2:4] == b'\x00\x00'

    s = sha1("http://sp.example.com/saml.xml".encode("utf8"))
    _x = s.digest()
    _y = art[4:24]
    assert _x == _y