Example #1
0
def test_private_key_jwt():
    cli = Client("FOO")
    cli.token_endpoint = "https://example.com/token"
    cli.keyjar[""] = KC_RSA

    cis = AccessTokenRequest()
    at = oic.private_key_jwt(cli, cis, algorithm="RS256")
    assert at == {}
    cas = cis["client_assertion"]
    header, claim, crypto, header_b64, claim_b64 = unpack(cas)
    jso = json.loads(claim)
    assert _eq(jso.keys(), ["aud", "iss", "sub", "jti", "exp", "iat"])
    print header
    assert header == {'alg': 'RS256'}
Example #2
0
def test_private_key_jwt():
    cli = Client("FOO")
    cli.token_endpoint = "https://example.com/token"
    cli.keystore.set_sign_key(rsapub, "rsa")
    cli.keystore.set_verify_key(rsapub, "rsa")

    cis = AccessTokenRequest()
    at = oic.private_key_jwt(cli, cis)
    assert at == {}
    cas = cis["client_assertion"]
    header, claim, crypto, header_b64, claim_b64 = unpack(cas)
    jso = json.loads(claim)
    assert _eq(jso.keys(), ["aud", "iss", "prn", "jti", "exp", "iat"])
    print header
    assert header == {"alg": "RS256"}