pypomes-jwt 1.1.4__tar.gz → 1.1.5__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.
- {pypomes_jwt-1.1.4 → pypomes_jwt-1.1.5}/PKG-INFO +2 -2
- {pypomes_jwt-1.1.4 → pypomes_jwt-1.1.5}/pyproject.toml +2 -2
- {pypomes_jwt-1.1.4 → pypomes_jwt-1.1.5}/src/pypomes_jwt/__init__.py +1 -1
- {pypomes_jwt-1.1.4 → pypomes_jwt-1.1.5}/src/pypomes_jwt/jwt_pomes.py +3 -3
- {pypomes_jwt-1.1.4 → pypomes_jwt-1.1.5}/src/pypomes_jwt/jwt_registry.py +3 -15
- {pypomes_jwt-1.1.4 → pypomes_jwt-1.1.5}/.gitignore +0 -0
- {pypomes_jwt-1.1.4 → pypomes_jwt-1.1.5}/LICENSE +0 -0
- {pypomes_jwt-1.1.4 → pypomes_jwt-1.1.5}/README.md +0 -0
- /pypomes_jwt-1.1.4/src/pypomes_jwt/jwt_configuration.py → /pypomes_jwt-1.1.5/src/pypomes_jwt/jwt_config.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pypomes_jwt
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.5
|
|
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,5 +12,5 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
12
|
Requires-Python: >=3.12
|
|
13
13
|
Requires-Dist: cryptography>=44.0.2
|
|
14
14
|
Requires-Dist: pyjwt>=2.10.1
|
|
15
|
-
Requires-Dist: pypomes-core>=2.0.
|
|
15
|
+
Requires-Dist: pypomes-core>=2.0.4
|
|
16
16
|
Requires-Dist: pypomes-db>=2.1.1
|
|
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "pypomes_jwt"
|
|
9
|
-
version = "1.1.
|
|
9
|
+
version = "1.1.5"
|
|
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.2",
|
|
24
|
-
"pypomes_core>=2.0.
|
|
24
|
+
"pypomes_core>=2.0.4",
|
|
25
25
|
"pypomes_db>=2.1.1"
|
|
26
26
|
]
|
|
27
27
|
|
|
@@ -10,7 +10,7 @@ from pypomes_db import (
|
|
|
10
10
|
)
|
|
11
11
|
from typing import Any
|
|
12
12
|
|
|
13
|
-
from .
|
|
13
|
+
from .jwt_config import JwtConfig, JwtDbConfig
|
|
14
14
|
from .jwt_registry import JwtRegistry
|
|
15
15
|
|
|
16
16
|
# the JWT registry
|
|
@@ -511,8 +511,8 @@ def jwt_get_claims(errors: list[str] | None,
|
|
|
511
511
|
"""
|
|
512
512
|
Retrieve and return the claims set of a JWT *token*.
|
|
513
513
|
|
|
514
|
-
Any well-constructed JWT token may be provided in *token*, as this operation is not restricted
|
|
515
|
-
locally issued tokens. Note that neither the token's signature nor its expiration is verified.
|
|
514
|
+
Any well-constructed JWT token may be provided in *token*, as this operation is not restricted
|
|
515
|
+
to locally issued tokens. Note that neither the token's signature nor its expiration is verified.
|
|
516
516
|
|
|
517
517
|
Structure of the returned data, for locally issued tokens:
|
|
518
518
|
{
|
|
@@ -12,7 +12,7 @@ from pypomes_db import (
|
|
|
12
12
|
from threading import Lock
|
|
13
13
|
from typing import Any
|
|
14
14
|
|
|
15
|
-
from .
|
|
15
|
+
from .jwt_config import JwtConfig, JwtDbConfig
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class JwtRegistry:
|
|
@@ -205,14 +205,8 @@ class JwtRegistry:
|
|
|
205
205
|
current_claims["iat"] = just_now
|
|
206
206
|
if grace_interval:
|
|
207
207
|
current_claims["nbf"] = just_now + grace_interval
|
|
208
|
-
current_claims["valid-from"] = datetime.fromtimestamp(timestamp=current_claims["nbf"],
|
|
209
|
-
tz=timezone.utc).isoformat()
|
|
210
|
-
else:
|
|
211
|
-
current_claims["valid-from"] = datetime.fromtimestamp(timestamp=current_claims["iat"],
|
|
212
|
-
tz=timezone.utc).isoformat()
|
|
213
208
|
current_claims["exp"] = just_now + duration
|
|
214
|
-
|
|
215
|
-
tz=timezone.utc).isoformat()
|
|
209
|
+
|
|
216
210
|
# may raise an exception
|
|
217
211
|
return jwt.encode(payload=current_claims,
|
|
218
212
|
key=JwtConfig.ENCODING_KEY.value,
|
|
@@ -265,15 +259,9 @@ class JwtRegistry:
|
|
|
265
259
|
grace_interval = account_data.get("grace-interval")
|
|
266
260
|
if grace_interval:
|
|
267
261
|
current_claims["nbf"] = just_now + grace_interval
|
|
268
|
-
|
|
269
|
-
tz=timezone.utc).isoformat()
|
|
270
|
-
else:
|
|
271
|
-
current_claims["valid-from"] = datetime.fromtimestamp(timestamp=current_claims["iat"],
|
|
272
|
-
tz=timezone.utc).isoformat()
|
|
262
|
+
|
|
273
263
|
# issue a candidate refresh token first, and persist it
|
|
274
264
|
current_claims["exp"] = just_now + account_data.get("refresh-max-age")
|
|
275
|
-
current_claims["valid-until"] = datetime.fromtimestamp(timestamp=current_claims["exp"],
|
|
276
|
-
tz=timezone.utc).isoformat()
|
|
277
265
|
# may raise an exception
|
|
278
266
|
refresh_token: str = jwt.encode(payload=current_claims,
|
|
279
267
|
key=JwtConfig.ENCODING_KEY.value,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|