pypomes-jwt 1.2.7__py3-none-any.whl → 1.2.8__py3-none-any.whl
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/jwt_pomes.py +16 -14
- {pypomes_jwt-1.2.7.dist-info → pypomes_jwt-1.2.8.dist-info}/METADATA +3 -3
- {pypomes_jwt-1.2.7.dist-info → pypomes_jwt-1.2.8.dist-info}/RECORD +5 -5
- {pypomes_jwt-1.2.7.dist-info → pypomes_jwt-1.2.8.dist-info}/WHEEL +0 -0
- {pypomes_jwt-1.2.7.dist-info → pypomes_jwt-1.2.8.dist-info}/licenses/LICENSE +0 -0
pypomes_jwt/jwt_pomes.py
CHANGED
|
@@ -6,7 +6,7 @@ from logging import Logger
|
|
|
6
6
|
from pypomes_core import exc_format
|
|
7
7
|
from pypomes_db import (
|
|
8
8
|
DbEngine, db_connect, db_commit,
|
|
9
|
-
db_rollback, db_select, db_delete
|
|
9
|
+
db_rollback, db_close, db_select, db_delete
|
|
10
10
|
)
|
|
11
11
|
from typing import Any
|
|
12
12
|
|
|
@@ -254,18 +254,18 @@ def jwt_validate_token(token: str,
|
|
|
254
254
|
return result
|
|
255
255
|
|
|
256
256
|
|
|
257
|
-
def jwt_revoke_token(
|
|
258
|
-
account_id: str,
|
|
257
|
+
def jwt_revoke_token(account_id: str,
|
|
259
258
|
token: str,
|
|
259
|
+
errors: list[str] = None,
|
|
260
260
|
logger: Logger = None) -> bool:
|
|
261
261
|
"""
|
|
262
262
|
Revoke the *refresh_token* associated with *account_id*.
|
|
263
263
|
|
|
264
264
|
Revoke operations require access to a database table defined by *JWT_DB_TABLE*.
|
|
265
265
|
|
|
266
|
-
:param errors: incidental error messages
|
|
267
266
|
:param account_id: the account identification
|
|
268
267
|
:param token: the token to be revoked
|
|
268
|
+
:param errors: incidental error messages
|
|
269
269
|
:param logger: optional logger
|
|
270
270
|
:return: *True* if operation could be performed, *False* otherwise
|
|
271
271
|
"""
|
|
@@ -285,13 +285,13 @@ def jwt_revoke_token(errors: list[str] | None,
|
|
|
285
285
|
if token_kid[0:1] not in ["A", "R"]:
|
|
286
286
|
op_errors.append("Invalid token")
|
|
287
287
|
else:
|
|
288
|
-
db_delete(
|
|
289
|
-
delete_stmt=f"DELETE FROM {JwtDbConfig.TABLE}",
|
|
288
|
+
db_delete(delete_stmt=f"DELETE FROM {JwtDbConfig.TABLE}",
|
|
290
289
|
where_data={
|
|
291
290
|
JwtDbConfig.COL_KID: int(token_kid[1:]),
|
|
292
291
|
JwtDbConfig.COL_ACCOUNT: account_id
|
|
293
292
|
},
|
|
294
293
|
engine=DbEngine(JwtDbConfig.ENGINE),
|
|
294
|
+
errors=op_errors,
|
|
295
295
|
logger=logger)
|
|
296
296
|
if op_errors:
|
|
297
297
|
if logger:
|
|
@@ -304,12 +304,12 @@ def jwt_revoke_token(errors: list[str] | None,
|
|
|
304
304
|
return result
|
|
305
305
|
|
|
306
306
|
|
|
307
|
-
def jwt_issue_token(
|
|
308
|
-
account_id: str,
|
|
307
|
+
def jwt_issue_token(account_id: str,
|
|
309
308
|
nature: str,
|
|
310
309
|
duration: int,
|
|
311
310
|
lead_interval: int = None,
|
|
312
311
|
claims: dict[str, Any] = None,
|
|
312
|
+
errors: list[str] = None,
|
|
313
313
|
logger: Logger = None) -> str:
|
|
314
314
|
"""
|
|
315
315
|
Issue or refresh, and return, a JWT token associated with *account_id*, of the specified *nature*.
|
|
@@ -319,12 +319,12 @@ def jwt_issue_token(errors: list[str] | None,
|
|
|
319
319
|
The parameter *duration* specifies the token's validity interval (at least 60 seconds).
|
|
320
320
|
These claims are ignored, if specified in *claims*: *iat*, *iss*, *exp*, *jti*, *nbf*, and *sub*.
|
|
321
321
|
|
|
322
|
-
:param errors: incidental error messages
|
|
323
322
|
:param account_id: the account identification
|
|
324
323
|
:param nature: the token's nature, must be a single letter in the range *[B-Z]*, less *R*
|
|
325
324
|
:param duration: the number of seconds for the token to remain valid (at least 60 seconds)
|
|
326
325
|
:param claims: optional token's claims
|
|
327
326
|
:param lead_interval: optional interval for the token to become active (in seconds)
|
|
327
|
+
:param errors: incidental error messages
|
|
328
328
|
:param logger: optional logger
|
|
329
329
|
:return: the JWT token data, or *None* if error
|
|
330
330
|
"""
|
|
@@ -358,9 +358,9 @@ def jwt_issue_token(errors: list[str] | None,
|
|
|
358
358
|
return result
|
|
359
359
|
|
|
360
360
|
|
|
361
|
-
def jwt_issue_tokens(
|
|
362
|
-
account_id: str,
|
|
361
|
+
def jwt_issue_tokens(account_id: str,
|
|
363
362
|
account_claims: dict[str, Any] = None,
|
|
363
|
+
errors: list[str] = None,
|
|
364
364
|
logger: Logger = None) -> dict[str, Any]:
|
|
365
365
|
"""
|
|
366
366
|
Issue the JWT token pair associated with *account_id*, for access and refresh operations.
|
|
@@ -376,9 +376,9 @@ def jwt_issue_tokens(errors: list[str] | None,
|
|
|
376
376
|
"refresh-token": <jwt-token>
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
-
:param errors: incidental error messages
|
|
380
379
|
:param account_id: the account identification
|
|
381
380
|
:param account_claims: if provided, may supercede currently registered account-related claims
|
|
381
|
+
:param errors: incidental error messages
|
|
382
382
|
:param logger: optional logger
|
|
383
383
|
:return: the JWT token data, or *None* if error
|
|
384
384
|
"""
|
|
@@ -412,9 +412,9 @@ def jwt_issue_tokens(errors: list[str] | None,
|
|
|
412
412
|
return result
|
|
413
413
|
|
|
414
414
|
|
|
415
|
-
def jwt_refresh_tokens(
|
|
416
|
-
account_id: str,
|
|
415
|
+
def jwt_refresh_tokens(account_id: str,
|
|
417
416
|
refresh_token: str,
|
|
417
|
+
errors: list[str] = None,
|
|
418
418
|
logger: Logger = None) -> dict[str, Any]:
|
|
419
419
|
"""
|
|
420
420
|
Refresh the JWT token pair associated with *account_id*, for access and refresh operations.
|
|
@@ -497,6 +497,8 @@ def jwt_refresh_tokens(errors: list[str] | None,
|
|
|
497
497
|
db_commit(connection=db_conn,
|
|
498
498
|
errors=op_errors,
|
|
499
499
|
logger=logger)
|
|
500
|
+
db_close(connection=db_conn,
|
|
501
|
+
logger=logger)
|
|
500
502
|
else:
|
|
501
503
|
# refresh token not found
|
|
502
504
|
op_errors.append("Refresh token was not provided")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pypomes_jwt
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.8
|
|
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
|
|
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Requires-Python: >=3.12
|
|
13
13
|
Requires-Dist: cryptography>=45.0.6
|
|
14
|
-
Requires-Dist: flask>=3.1.
|
|
14
|
+
Requires-Dist: flask>=3.1.2
|
|
15
15
|
Requires-Dist: pyjwt>=2.10.1
|
|
16
16
|
Requires-Dist: pypomes-core>=2.7.0
|
|
17
|
-
Requires-Dist: pypomes-db>=2.5.
|
|
17
|
+
Requires-Dist: pypomes-db>=2.5.8
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
pypomes_jwt/__init__.py,sha256=vXAeaEnuUqpvGtV465TsW2Lf3ihijrMP2Hm4My79y88,968
|
|
2
2
|
pypomes_jwt/jwt_config.py,sha256=3r9XPWXXAG_wKUs_FDZoTj9j6lmTdNymud_q4E4Opk0,3338
|
|
3
|
-
pypomes_jwt/jwt_pomes.py,sha256=
|
|
3
|
+
pypomes_jwt/jwt_pomes.py,sha256=P7d_8h3VPmrbtZWCcLnGdFV31c59B5CcmBrBSgILT1Q,23881
|
|
4
4
|
pypomes_jwt/jwt_providers.py,sha256=wDIP6W-l_X1zrWeCNFGcRsb8Ui1Sja-3StcuRtLTjR4,5928
|
|
5
5
|
pypomes_jwt/jwt_registry.py,sha256=AyaoSK4KMhRiRACTImK5z0AzQBwhG5cBkazPjkrzdaI,22046
|
|
6
|
-
pypomes_jwt-1.2.
|
|
7
|
-
pypomes_jwt-1.2.
|
|
8
|
-
pypomes_jwt-1.2.
|
|
9
|
-
pypomes_jwt-1.2.
|
|
6
|
+
pypomes_jwt-1.2.8.dist-info/METADATA,sha256=3Kd-oLzz7qrIBH7fl-FFtW64G3NkyHgBJQcXnjXkwxw,660
|
|
7
|
+
pypomes_jwt-1.2.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8
|
+
pypomes_jwt-1.2.8.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
|
|
9
|
+
pypomes_jwt-1.2.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|