Exemplo n.º 1
0
def test_dumps_loads():
    bundle = JWKSBundle(ISS, SIGN_KEYS)
    bundle['https://www.swamid.se'] = KEYJAR['https://www.swamid.se']
    bundle['https://www.sunet.se'] = KEYJAR['https://www.sunet.se']
    bundle['https://www.feide.no'] = KEYJAR['https://www.feide.no']

    _str = bundle.dumps()

    bundle2 = JWKSBundle(ISS, SIGN_KEYS)
    bundle2.loads(_str)

    assert set(bundle.keys()) == set(bundle2.keys())

    for iss, kj in bundle.items():
        assert bundle2[iss] == kj
Exemplo n.º 2
0
def test_sign_verify():
    bundle = JWKSBundle(ISS, SIGN_KEYS)
    bundle['https://www.swamid.se'] = KEYJAR['https://www.swamid.se']
    bundle['https://www.sunet.se'] = KEYJAR['https://www.sunet.se']
    bundle['https://www.feide.no'] = KEYJAR['https://www.feide.no']

    _jws = bundle.create_signed_bundle()

    bundle2 = JWKSBundle(ISS2)
    verify_keys = SIGN_KEYS.copy()
    verify_keys.issuer_keys[ISS] = verify_keys.issuer_keys['']

    bundle2.upload_signed_bundle(_jws, verify_keys)

    assert set(bundle.keys()) == set(bundle2.keys())

    for iss, kj in bundle.items():
        assert bundle2[iss] == kj