pypomes-jwt 0.6.1__tar.gz → 0.6.2__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.

Potentially problematic release.


This version of pypomes-jwt might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypomes_jwt
3
- Version: 0.6.1
3
+ Version: 0.6.2
4
4
  Summary: A collection of Python pomes, penyeach (JWT module)
5
5
  Project-URL: Homepage, https://github.com/TheWiseCoder/PyPomes-JWT
6
6
  Project-URL: Bug Tracker, https://github.com/TheWiseCoder/PyPomes-JWT/issues
@@ -12,4 +12,4 @@ Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.12
13
13
  Requires-Dist: cryptography>=44.0.1
14
14
  Requires-Dist: pyjwt>=2.10.1
15
- Requires-Dist: pypomes-core>=1.7.7
15
+ Requires-Dist: pypomes-core>=1.7.8
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "pypomes_jwt"
9
- version = "0.6.1"
9
+ version = "0.6.2"
10
10
  authors = [
11
11
  { name="GT Nunes", email="wisecoder01@gmail.com" }
12
12
  ]
@@ -21,7 +21,7 @@ classifiers = [
21
21
  dependencies = [
22
22
  "PyJWT>=2.10.1",
23
23
  "cryptography>=44.0.1",
24
- "pypomes_core>=1.7.7"
24
+ "pypomes_core>=1.7.8"
25
25
  ]
26
26
 
27
27
  [project.urls]
@@ -3,6 +3,7 @@ import requests
3
3
  from datetime import datetime, timedelta, timezone
4
4
  from jwt.exceptions import InvalidTokenError
5
5
  from logging import Logger
6
+ from pypomes_core import str_random
6
7
  from requests import Response
7
8
  from threading import Lock
8
9
  from typing import Any, Literal
@@ -120,7 +121,7 @@ class JwtData:
120
121
  "iss": reference_url,
121
122
  "exp": "<numeric-UTC-datetime>",
122
123
  "iat": "<numeric-UTC-datetime>",
123
- "jti": "<jwt-id",
124
+ "jti": "<jwt-id>",
124
125
  }
125
126
  custom_claims: dict[str, Any] = {}
126
127
  public_claims: dict[str, Any] = {}
@@ -225,11 +226,12 @@ class JwtData:
225
226
  raise RuntimeError(" - ".join(errors))
226
227
  else:
227
228
  # JWT service is being provided locally
229
+ reserved_claims["jti"] = str_random(size=16)
228
230
  reserved_claims["iat"] = just_now
229
231
  reserved_claims["exp"] = just_now + control_data.get("access-max-age")
230
232
  claims: dict[str, Any] = item_data.get("public-claims").copy()
231
- claims.update(reserved_claims)
232
- claims.update(custom_claims)
233
+ claims.update(m=reserved_claims)
234
+ claims.update(m=custom_claims)
233
235
  # may raise an exception
234
236
  token: str = jwt.encode(payload=claims,
235
237
  key=control_data.get("secret-key") or control_data.get("private-key"),
File without changes
File without changes
File without changes
File without changes