Skip to content

Commit 0941ab1

Browse files
committed
PAR request should contain a signed request object
1 parent fd99fc4 commit 0941ab1

File tree

1 file changed

+9
-1
lines changed
  • src/idpyoidc/client/oauth2/add_on

1 file changed

+9
-1
lines changed

src/idpyoidc/client/oauth2/add_on/par.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import logging
22

3+
from cryptojwt import JWT
34
from cryptojwt.utils import importer
45

56
from idpyoidc.client.client_auth import CLIENT_AUTHN_METHOD
@@ -49,8 +50,15 @@ def push_authorization(request_args: Message, service: Service, **kwargs):
4950
)
5051
_headers["Content-Type"] = "application/x-www-form-urlencoded"
5152

53+
# construct a signed request object
54+
_jwt = JWT(key_jar=_context.keyjar)
55+
_request_object = _jwt.pack(request_args)
56+
5257
# construct the message body
53-
_body = request_args.to_urlencoded()
58+
_required_params = {k: v for k, v in request_args.items() if k in request_args.required_parameters()}
59+
_required_params["request"] = _request_object
60+
_req = service.msg_type(**_required_params)
61+
_body = _req.to_urlencoded()
5462

5563
_http_client = method_args.get("http_client", None)
5664
if not _http_client:

0 commit comments

Comments
 (0)