Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 3ae1c0d

Browse files
committed
One should be able to set the lifetime of a JWT when using the make_openid_request function.
1 parent 4220f9a commit 3ae1c0d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/oidcmsg/oidc/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,8 @@ def factory(msgtype, **kwargs):
11571157
return oauth2.factory(msgtype, **kwargs)
11581158

11591159

1160-
def make_openid_request(arq, keys, issuer, request_object_signing_alg, recv, with_jti=False):
1160+
def make_openid_request(arq, keys, issuer, request_object_signing_alg, recv, with_jti=False,
1161+
lifetime=0):
11611162
"""
11621163
Construct the JWT to be passed by value (the request parameter) or by
11631164
reference (request_uri).
@@ -1169,12 +1170,15 @@ def make_openid_request(arq, keys, issuer, request_object_signing_alg, recv, wit
11691170
:param request_object_signing_alg: Which signing algorithm to use
11701171
:param recv: The intended receiver of the request
11711172
:param with_jti: Whether a JTI should be included in the JWT.
1173+
:param lifetime: How long the JWT is expect to be live.
11721174
:return: JWT encoded OpenID request
11731175
"""
11741176

11751177
_jwt = JWT(key_jar=keys, iss=issuer, sign_alg=request_object_signing_alg)
11761178
if with_jti:
11771179
_jwt.with_jti = True
1180+
if lifetime:
1181+
_jwt.lifetime = lifetime
11781182
return _jwt.pack(arq.to_dict(), owner=issuer, recv=recv)
11791183

11801184

0 commit comments

Comments
 (0)