From 1412fb3cf9f6c09947770b5db168e83f3c0d80de Mon Sep 17 00:00:00 2001 From: mahdavi Date: Tue, 30 Jul 2024 12:39:21 +0330 Subject: [PATCH 1/2] use user.pk instead of user.id --- oauth2_provider/oauth2_validators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oauth2_provider/oauth2_validators.py b/oauth2_provider/oauth2_validators.py index 47d65e851..3f372f90e 100644 --- a/oauth2_provider/oauth2_validators.py +++ b/oauth2_provider/oauth2_validators.py @@ -792,9 +792,9 @@ def get_jwt_bearer_token(self, token, token_handler, request): def get_claim_dict(self, request): if self._get_additional_claims_is_request_agnostic(): - claims = {"sub": lambda r: str(r.user.id)} + claims = {"sub": lambda r: str(r.user.pk)} else: - claims = {"sub": str(request.user.id)} + claims = {"sub": str(request.user.pk)} # https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims if self._get_additional_claims_is_request_agnostic(): From e50c58be467a178c7039f4a6d7bfa1ec82b1e803 Mon Sep 17 00:00:00 2001 From: mahdavi Date: Wed, 31 Jul 2024 10:33:02 +0330 Subject: [PATCH 2/2] update AUTHORS and CHANGELOG --- AUTHORS | 1 + CHANGELOG.md | 1 + 2 files changed, 2 insertions(+) diff --git a/AUTHORS b/AUTHORS index 357abc2fa..d8e3d0934 100644 --- a/AUTHORS +++ b/AUTHORS @@ -102,6 +102,7 @@ Rustem Saiargaliev Sandro Rodrigues Shaheed Haque Shaun Stanworth +Sayyid Hamid Mahdavi Silvano Cerza Sora Yanai Spencer Carroll diff --git a/CHANGELOG.md b/CHANGELOG.md index 362fd74b3..4c64e0046 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * #1425 Remove deprecated `RedirectURIValidator`, `WildcardSet` per #1345; `validate_logout_request` per #1274 ### Fixed +* fix user pk in creating OIDC JWT token ### Security ## [2.4.0] - 2024-05-13