|
22 | 22 | from oidcendpoint.exception import NotForMe |
23 | 23 | from oidcendpoint.oidc.authorization import Authorization |
24 | 24 | from oidcendpoint.oidc.token import AccessToken |
| 25 | +from oidcendpoint.oidc.userinfo import UserInfo |
25 | 26 |
|
26 | 27 | KEYDEFS = [ |
27 | 28 | {"type": "RSA", "key": "", "use": ["sig"]}, |
|
39 | 40 | "verify_ssl": False, |
40 | 41 | "endpoint": { |
41 | 42 | "token": {"path": "token", "class": AccessToken, "kwargs": {}}, |
42 | | - "authorization": {"path": "auth", "class": Authorization, "kwargs": {}} |
| 43 | + "authorization": {"path": "auth", "class": Authorization, "kwargs": {}}, |
| 44 | + "userinfo": {"path": "user", "class": UserInfo, "kwargs": {}} |
43 | 45 | }, |
44 | 46 | "template_dir": "template", |
45 | 47 | "jwks": { |
@@ -138,7 +140,7 @@ def test_private_key_jwt_reusage_other_endpoint(): |
138 | 140 | request = {"client_assertion": _assertion, "client_assertion_type": JWT_BEARER} |
139 | 141 |
|
140 | 142 | # This should be OK |
141 | | - authn_info = PrivateKeyJWT(endpoint_context).verify(request, endpoint="token") |
| 143 | + PrivateKeyJWT(endpoint_context).verify(request, endpoint="token") |
142 | 144 |
|
143 | 145 | # This should NOT be OK |
144 | 146 | with pytest.raises(NotForMe): |
@@ -375,3 +377,19 @@ def test_verify_client_bearer_header(): |
375 | 377 | res = verify_client(endpoint_context, request, token, get_client_id_from_token) |
376 | 378 | assert set(res.keys()) == {"token", "method", "client_id"} |
377 | 379 | assert res["method"] == "bearer_header" |
| 380 | + |
| 381 | + |
| 382 | +def test_jws_authn_method_aud_userinfo_endpoint(): |
| 383 | + client_keyjar = KeyJar() |
| 384 | + client_keyjar[conf["issuer"]] = KEYJAR.issuer_keys[""] |
| 385 | + # The only own key the client has a this point |
| 386 | + client_keyjar.add_symmetric("", client_secret, ["sig"]) |
| 387 | + |
| 388 | + _jwt = JWT(client_keyjar, iss=client_id, sign_alg="HS256") |
| 389 | + |
| 390 | + # audience is the OP - not specifically the user info endpoint |
| 391 | + _assertion = _jwt.pack({"aud": [conf["issuer"]]}) |
| 392 | + |
| 393 | + request = {"client_assertion": _assertion, "client_assertion_type": JWT_BEARER} |
| 394 | + |
| 395 | + assert JWSAuthnMethod(endpoint_context).verify(request, endpoint="userinfo") |
0 commit comments