예제 #1
0
    def test_load_keys_failed_fetching_jwks(self):
        url = "https://op.example.com/signed_jwks"
        responses.add(responses.GET, url, body=requests.ConnectionError("Error"))

        keyjar = KeyJarWithSignedKeyBundles()
        with pytest.raises(ValueError):
            keyjar.load_keys(url, "", None)
예제 #2
0
    def test_load_keys(self):
        expected_kid = "test key"
        issuer = "https://op.example.com"
        url = "{}/signed_jwks".format(issuer)
        signing_key = RSAKey(key=RSA.generate(1024), alg="RS256")

        jws = create_signed_jwks(signing_key, expected_kid)
        responses.add(responses.GET, url, body=jws, status=200, content_type="application/jose")

        keyjar = KeyJarWithSignedKeyBundles()
        keyjar.load_keys(url, issuer, signing_key)

        assert keyjar[issuer][0].keys()[0].kid == expected_kid