Exemplo n.º 1
0
def test_dict():
    sws_data = {"iss": "https://test.com", "redirect_uris": ["https://example.com"]}
    sws_m = SWSMessage()
    sws_m.from_dict(sws_data)
    data = sws_m.to_dict()
    for key in data:
        assert sws_data[key] == data[key]
    assert len(sws_data) == len(data)
Exemplo n.º 2
0
def create_software_statement(sws_data):
    sws_data["iss"] = "https://{host}:{port}/static/jwks.json".format(host=HOST, port=PORT)
    sws = SWSMessage()
    sws.from_dict(sws_data)

    _, keyjar, _ = build_keyjar(KEYS)
    alg = 'RS256'
    ckey = keyjar.get_signing_key(alg2keytype(alg), "",
                                  alg=alg)
    return sws.to_jwt(key=ckey, algorithm=alg)