Skip to content

Commit

Permalink
fix: jwt lib changed
Browse files Browse the repository at this point in the history
* pyjwt 2.10.0 changed the api to decode. verify-sub is now default.
  this change reinstates the old behavior
  • Loading branch information
utnapischtim committed Nov 28, 2024
1 parent 471f48f commit 035533e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions invenio_accounts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# This file is part of Invenio.
# Copyright (C) 2017-2024 CERN.
# Copyright (C) 2024 Graz University of Technology.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down Expand Up @@ -105,6 +106,13 @@ def jwt_decode_token(token):
return decode(
token,
current_app.config["ACCOUNTS_JWT_SECRET_KEY"],
options={
# Based on the JWT spec (https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.2)
# the "sub" claim has to be a string. However, we are not enforcing this
# and are assuming that the "sub" claim is an object/dictionary.
# PyJWT v2.10.0 started enforcing this and we are disabling this check.
"verify_sub": False,
},
algorithms=[current_app.config["ACCOUNTS_JWT_ALOGORITHM"]],
)
except DecodeError as exc:
Expand Down

0 comments on commit 035533e

Please sign in to comment.