pypomes-jwt 1.2.0__tar.gz → 1.2.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.
- {pypomes_jwt-1.2.0 → pypomes_jwt-1.2.2}/PKG-INFO +5 -5
- {pypomes_jwt-1.2.0 → pypomes_jwt-1.2.2}/pyproject.toml +5 -5
- {pypomes_jwt-1.2.0 → pypomes_jwt-1.2.2}/src/pypomes_jwt/jwt_pomes.py +10 -11
- {pypomes_jwt-1.2.0 → pypomes_jwt-1.2.2}/src/pypomes_jwt/jwt_registry.py +5 -6
- {pypomes_jwt-1.2.0 → pypomes_jwt-1.2.2}/.gitignore +0 -0
- {pypomes_jwt-1.2.0 → pypomes_jwt-1.2.2}/LICENSE +0 -0
- {pypomes_jwt-1.2.0 → pypomes_jwt-1.2.2}/README.md +0 -0
- {pypomes_jwt-1.2.0 → pypomes_jwt-1.2.2}/src/pypomes_jwt/__init__.py +0 -0
- {pypomes_jwt-1.2.0 → pypomes_jwt-1.2.2}/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.2.
|
|
3
|
+
Version: 1.2.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
|
|
@@ -10,8 +10,8 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Requires-Python: >=3.12
|
|
13
|
-
Requires-Dist: cryptography>=
|
|
13
|
+
Requires-Dist: cryptography>=45.0.2
|
|
14
|
+
Requires-Dist: flask>=3.1.1
|
|
14
15
|
Requires-Dist: pyjwt>=2.10.1
|
|
15
|
-
Requires-Dist: pypomes-core>=2.
|
|
16
|
-
Requires-Dist: pypomes-db>=2.1
|
|
17
|
-
Requires-Dist: pypomes-logging>=0.6.1
|
|
16
|
+
Requires-Dist: pypomes-core>=2.3.2
|
|
17
|
+
Requires-Dist: pypomes-db>=2.2.1
|
|
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "pypomes_jwt"
|
|
9
|
-
version = "1.2.
|
|
9
|
+
version = "1.2.2"
|
|
10
10
|
authors = [
|
|
11
11
|
{ name="GT Nunes", email="wisecoder01@gmail.com" }
|
|
12
12
|
]
|
|
@@ -19,11 +19,11 @@ classifiers = [
|
|
|
19
19
|
"Operating System :: OS Independent"
|
|
20
20
|
]
|
|
21
21
|
dependencies = [
|
|
22
|
+
"cryptography>=45.0.2",
|
|
23
|
+
"Flask>=3.1.1",
|
|
22
24
|
"PyJWT>=2.10.1",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"pypomes_db>=2.1.5",
|
|
26
|
-
"pypomes_logging>=0.6.1"
|
|
25
|
+
"pypomes_core>=2.3.2",
|
|
26
|
+
"pypomes_db>=2.2.1"
|
|
27
27
|
]
|
|
28
28
|
|
|
29
29
|
[project.urls]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import jwt
|
|
2
2
|
import sys
|
|
3
|
-
from base64 import
|
|
3
|
+
from base64 import b64decode
|
|
4
4
|
from flask import Request, Response, request
|
|
5
5
|
from logging import Logger
|
|
6
6
|
from pypomes_core import exc_format
|
|
@@ -8,7 +8,6 @@ from pypomes_db import (
|
|
|
8
8
|
DbEngine, db_connect, db_commit,
|
|
9
9
|
db_rollback, db_select, db_delete
|
|
10
10
|
)
|
|
11
|
-
from pypomes_logging import PYPOMES_LOGGER
|
|
12
11
|
from typing import Any
|
|
13
12
|
|
|
14
13
|
from .jwt_config import JwtConfig, JwtDbConfig
|
|
@@ -86,7 +85,7 @@ def jwt_set_account(account_id: str,
|
|
|
86
85
|
access_max_age: int = JwtConfig.ACCESS_MAX_AGE.value,
|
|
87
86
|
refresh_max_age: int = JwtConfig.REFRESH_MAX_AGE.value,
|
|
88
87
|
lead_interval: int = None,
|
|
89
|
-
logger: Logger =
|
|
88
|
+
logger: Logger = None) -> None:
|
|
90
89
|
"""
|
|
91
90
|
Establish the data needed to obtain JWT tokens for *account_id*.
|
|
92
91
|
|
|
@@ -115,7 +114,7 @@ def jwt_set_account(account_id: str,
|
|
|
115
114
|
|
|
116
115
|
|
|
117
116
|
def jwt_remove_account(account_id: str,
|
|
118
|
-
logger: Logger =
|
|
117
|
+
logger: Logger = None) -> bool:
|
|
119
118
|
"""
|
|
120
119
|
Remove from storage the JWT access data for *account_id*.
|
|
121
120
|
|
|
@@ -134,7 +133,7 @@ def jwt_validate_token(errors: list[str] | None,
|
|
|
134
133
|
token: str,
|
|
135
134
|
nature: str = None,
|
|
136
135
|
account_id: str = None,
|
|
137
|
-
logger: Logger =
|
|
136
|
+
logger: Logger = None) -> dict[str, Any] | None:
|
|
138
137
|
"""
|
|
139
138
|
Verify if *token* ia a valid JWT token.
|
|
140
139
|
|
|
@@ -198,7 +197,7 @@ def jwt_validate_token(errors: list[str] | None,
|
|
|
198
197
|
logger=logger)
|
|
199
198
|
if recs:
|
|
200
199
|
token_alg = recs[0][0]
|
|
201
|
-
token_decoder =
|
|
200
|
+
token_decoder = b64decode(recs[0][1])
|
|
202
201
|
elif op_errors:
|
|
203
202
|
if logger:
|
|
204
203
|
logger.error(msg=f"Error retrieving the token's decoder: {'; '.join(op_errors)}")
|
|
@@ -259,7 +258,7 @@ def jwt_validate_token(errors: list[str] | None,
|
|
|
259
258
|
def jwt_revoke_token(errors: list[str] | None,
|
|
260
259
|
account_id: str,
|
|
261
260
|
token: str,
|
|
262
|
-
logger: Logger =
|
|
261
|
+
logger: Logger = None) -> bool:
|
|
263
262
|
"""
|
|
264
263
|
Revoke the *refresh_token* associated with *account_id*.
|
|
265
264
|
|
|
@@ -312,7 +311,7 @@ def jwt_issue_token(errors: list[str] | None,
|
|
|
312
311
|
duration: int,
|
|
313
312
|
lead_interval: int = None,
|
|
314
313
|
claims: dict[str, Any] = None,
|
|
315
|
-
logger: Logger =
|
|
314
|
+
logger: Logger = None) -> str:
|
|
316
315
|
"""
|
|
317
316
|
Issue or refresh, and return, a JWT token associated with *account_id*, of the specified *nature*.
|
|
318
317
|
|
|
@@ -363,7 +362,7 @@ def jwt_issue_token(errors: list[str] | None,
|
|
|
363
362
|
def jwt_issue_tokens(errors: list[str] | None,
|
|
364
363
|
account_id: str,
|
|
365
364
|
account_claims: dict[str, Any] = None,
|
|
366
|
-
logger: Logger =
|
|
365
|
+
logger: Logger = None) -> dict[str, Any]:
|
|
367
366
|
"""
|
|
368
367
|
Issue the JWT token pair associated with *account_id*, for access and refresh operations.
|
|
369
368
|
|
|
@@ -417,7 +416,7 @@ def jwt_issue_tokens(errors: list[str] | None,
|
|
|
417
416
|
def jwt_refresh_tokens(errors: list[str] | None,
|
|
418
417
|
account_id: str,
|
|
419
418
|
refresh_token: str,
|
|
420
|
-
logger: Logger =
|
|
419
|
+
logger: Logger = None) -> dict[str, Any]:
|
|
421
420
|
"""
|
|
422
421
|
Refresh the JWT token pair associated with *account_id*, for access and refresh operations.
|
|
423
422
|
|
|
@@ -515,7 +514,7 @@ def jwt_refresh_tokens(errors: list[str] | None,
|
|
|
515
514
|
|
|
516
515
|
def jwt_get_claims(errors: list[str] | None,
|
|
517
516
|
token: str,
|
|
518
|
-
logger: Logger =
|
|
517
|
+
logger: Logger = None) -> dict[str, Any] | None:
|
|
519
518
|
"""
|
|
520
519
|
Retrieve and return the claims set of a JWT *token*.
|
|
521
520
|
|
|
@@ -9,7 +9,6 @@ from pypomes_db import (
|
|
|
9
9
|
DbEngine, db_connect, db_commit, db_rollback,
|
|
10
10
|
db_select, db_insert, db_update, db_delete
|
|
11
11
|
)
|
|
12
|
-
from pypomes_logging import PYPOMES_LOGGER
|
|
13
12
|
from threading import Lock
|
|
14
13
|
from typing import Any
|
|
15
14
|
|
|
@@ -89,7 +88,7 @@ class JwtRegistry:
|
|
|
89
88
|
access_max_age: int,
|
|
90
89
|
refresh_max_age: int,
|
|
91
90
|
lead_interval: int | None,
|
|
92
|
-
logger: Logger =
|
|
91
|
+
logger: Logger = None) -> None:
|
|
93
92
|
"""
|
|
94
93
|
Add to storage the parameters needed to produce and validate JWT tokens for *account_id*.
|
|
95
94
|
|
|
@@ -153,7 +152,7 @@ class JwtRegistry:
|
|
|
153
152
|
duration: int,
|
|
154
153
|
lead_interval: int = None,
|
|
155
154
|
claims: dict[str, Any] = None,
|
|
156
|
-
logger: Logger =
|
|
155
|
+
logger: Logger = None) -> str:
|
|
157
156
|
"""
|
|
158
157
|
Issue an return a JWT token associated with *account_id*.
|
|
159
158
|
|
|
@@ -213,7 +212,7 @@ class JwtRegistry:
|
|
|
213
212
|
account_id: str,
|
|
214
213
|
account_claims: dict[str, Any] = None,
|
|
215
214
|
db_conn: Any = None,
|
|
216
|
-
logger: Logger =
|
|
215
|
+
logger: Logger = None) -> dict[str, Any]:
|
|
217
216
|
"""
|
|
218
217
|
Issue and return a JWT token pair associated with *account_id*.
|
|
219
218
|
|
|
@@ -320,7 +319,7 @@ class JwtRegistry:
|
|
|
320
319
|
|
|
321
320
|
def get_account_data(self,
|
|
322
321
|
account_id: str,
|
|
323
|
-
logger: Logger =
|
|
322
|
+
logger: Logger = None) -> dict[str, Any]:
|
|
324
323
|
"""
|
|
325
324
|
Retrieve the JWT access data associated with *account_id*.
|
|
326
325
|
|
|
@@ -342,7 +341,7 @@ class JwtRegistry:
|
|
|
342
341
|
def jwt_persist_token(account_id: str,
|
|
343
342
|
jwt_token: str,
|
|
344
343
|
db_conn: Any,
|
|
345
|
-
logger: Logger =
|
|
344
|
+
logger: Logger = None) -> int:
|
|
346
345
|
"""
|
|
347
346
|
Persist the given token, making sure that the account limit is complied with.
|
|
348
347
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|