dj-jwt-auth 1.3.2__tar.gz → 1.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/PKG-INFO +2 -1
  2. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/README.md +1 -0
  3. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/dj_jwt_auth.egg-info/PKG-INFO +2 -1
  4. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/django_jwt/settings.py +1 -0
  5. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/django_jwt/user.py +1 -2
  6. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/setup.cfg +1 -1
  7. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/tests/test.py +3 -5
  8. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/dj_jwt_auth.egg-info/SOURCES.txt +0 -0
  9. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/dj_jwt_auth.egg-info/dependency_links.txt +0 -0
  10. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/dj_jwt_auth.egg-info/requires.txt +0 -0
  11. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/dj_jwt_auth.egg-info/top_level.txt +0 -0
  12. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/django_jwt/__init__.py +0 -0
  13. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/django_jwt/config.py +0 -0
  14. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/django_jwt/exceptions.py +0 -0
  15. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/django_jwt/middleware.py +0 -0
  16. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/django_jwt/pkce.py +0 -0
  17. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/django_jwt/roles.py +0 -0
  18. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/django_jwt/urls.py +0 -0
  19. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/django_jwt/utils.py +0 -0
  20. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/django_jwt/views.py +0 -0
  21. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/pyproject.toml +0 -0
  22. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/setup.py +0 -0
  23. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/tests/__init__.py +0 -0
  24. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/tests/models.py +0 -0
  25. {dj-jwt-auth-1.3.2 → dj-jwt-auth-1.4.0}/tests/urls.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dj-jwt-auth
3
- Version: 1.3.2
3
+ Version: 1.4.0
4
4
  Summary: A Django package for JSON Web Token validation and verification. Using PyJWT.
5
5
  Home-page: https://www.example.com/
6
6
  Author: Konstantin Seleznev
@@ -65,6 +65,7 @@ User retated variables:
65
65
  - OIDC_USER_MODIFIED_FIELD - user model field to store last modified date, by default `modified_timestamp`
66
66
  - OIDC_TOKEN_MODIFIED_FIELD - access token field to store last modified date, by default `updated_at`
67
67
  - OIDC_USER_UID - User model" unique identifier, by default `kc_id`
68
+ - OIDC_TOKEN_USER_UID - access token field to store user UID, by default `sub`
68
69
  - OIDC_USER_MAPPING - mapping between JWT claims and user model fields, by default:
69
70
  ```
70
71
  OIDC_USER_MAPPING = {
@@ -41,6 +41,7 @@ User retated variables:
41
41
  - OIDC_USER_MODIFIED_FIELD - user model field to store last modified date, by default `modified_timestamp`
42
42
  - OIDC_TOKEN_MODIFIED_FIELD - access token field to store last modified date, by default `updated_at`
43
43
  - OIDC_USER_UID - User model" unique identifier, by default `kc_id`
44
+ - OIDC_TOKEN_USER_UID - access token field to store user UID, by default `sub`
44
45
  - OIDC_USER_MAPPING - mapping between JWT claims and user model fields, by default:
45
46
  ```
46
47
  OIDC_USER_MAPPING = {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dj-jwt-auth
3
- Version: 1.3.2
3
+ Version: 1.4.0
4
4
  Summary: A Django package for JSON Web Token validation and verification. Using PyJWT.
5
5
  Home-page: https://www.example.com/
6
6
  Author: Konstantin Seleznev
@@ -65,6 +65,7 @@ User retated variables:
65
65
  - OIDC_USER_MODIFIED_FIELD - user model field to store last modified date, by default `modified_timestamp`
66
66
  - OIDC_TOKEN_MODIFIED_FIELD - access token field to store last modified date, by default `updated_at`
67
67
  - OIDC_USER_UID - User model" unique identifier, by default `kc_id`
68
+ - OIDC_TOKEN_USER_UID - access token field to store user UID, by default `sub`
68
69
  - OIDC_USER_MAPPING - mapping between JWT claims and user model fields, by default:
69
70
  ```
70
71
  OIDC_USER_MAPPING = {
@@ -8,6 +8,7 @@ OIDC_CONFIG_URL = getattr(settings, "OIDC_CONFIG_URL", None)
8
8
  OIDC_USER_UPDATE = getattr(settings, "OIDC_USER_UPDATE", True)
9
9
  OIDC_USER_MODIFIED_FIELD = getattr(settings, "OIDC_USER_MODIFIED_FIELD", "modified_timestamp")
10
10
  OIDC_TOKEN_MODIFIED_FIELD = getattr(settings, "OIDC_TOKEN_MODIFIED_FIELD", "updated_at")
11
+ OIDC_TOKEN_USER_UID = getattr(settings, "OIDC_TOKEN_USER_UID", "sub")
11
12
  OIDC_USER_UID = getattr(settings, "OIDC_USER_UID", "kc_id")
12
13
  OIDC_USER_MAPPING = getattr(
13
14
  settings,
@@ -21,9 +21,8 @@ class UserHandler:
21
21
 
22
22
  def __init__(self, payload: dict, request: HttpRequest, access_token: str):
23
23
  # payload of access token without user info
24
- # auth0_id should be available if auth0 added in Client Scopes in KeyCloak admin
25
24
  self.kwargs = settings.OIDC_USER_DEFAULTS.copy()
26
- self.kwargs[settings.OIDC_USER_UID] = payload.get("auth0_id", payload["sub"])
25
+ self.kwargs[settings.OIDC_USER_UID] = payload[settings.OIDC_TOKEN_USER_UID]
27
26
 
28
27
  modified_at = payload.get(settings.OIDC_TOKEN_MODIFIED_FIELD, None)
29
28
  if modified_at and isinstance(modified_at, int):
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = dj-jwt-auth
3
- version = 1.3.2
3
+ version = 1.4.0
4
4
  description = A Django package for JSON Web Token validation and verification. Using PyJWT.
5
5
  long_description = file: README.md
6
6
  url = https://www.example.com/
@@ -13,13 +13,11 @@ from django_jwt.user import role_handler
13
13
  from django_jwt.roles import ROLE
14
14
 
15
15
  access_token_payload = {
16
- "sub": "12345",
17
- "auth0_id": "1234",
16
+ "sub": "1234",
18
17
  "updated_at": 2687276498,
19
18
  }
20
19
  user_info_payload = {
21
- "sub": "12345",
22
- "auth0_id": "1234",
20
+ "sub": "1234",
23
21
  "email": "example@bk.com",
24
22
  "name": "UserName",
25
23
  "given_name": "1st name",
@@ -51,7 +49,7 @@ class OIDCHandlerTest(TestCase):
51
49
  self.assertEqual(self.request.user.last_name, user_info_payload["family_name"])
52
50
  self.assertEqual(self.request.user.username, user_info_payload["name"])
53
51
  self.assertEqual(self.request.user.email, user_info_payload["email"])
54
- self.assertEqual(self.request.user.kc_id, user_info_payload["auth0_id"])
52
+ self.assertEqual(self.request.user.kc_id, user_info_payload["sub"])
55
53
 
56
54
  def test_keycloak_new_user(self, *_):
57
55
  """User is created if it doesn't exist in database"""
File without changes
File without changes
File without changes
File without changes