pypomes-jwt 1.1.2__py3-none-any.whl → 1.1.3__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_configuration.py +1 -22
- pypomes_jwt/jwt_pomes.py +4 -0
- pypomes_jwt/jwt_registry.py +8 -0
- {pypomes_jwt-1.1.2.dist-info → pypomes_jwt-1.1.3.dist-info}/METADATA +2 -2
- pypomes_jwt-1.1.3.dist-info/RECORD +8 -0
- pypomes_jwt-1.1.2.dist-info/RECORD +0 -8
- {pypomes_jwt-1.1.2.dist-info → pypomes_jwt-1.1.3.dist-info}/WHEEL +0 -0
- {pypomes_jwt-1.1.2.dist-info → pypomes_jwt-1.1.3.dist-info}/licenses/LICENSE +0 -0
pypomes_jwt/jwt_configuration.py
CHANGED
|
@@ -6,9 +6,8 @@ from pypomes_core import (
|
|
|
6
6
|
APP_PREFIX,
|
|
7
7
|
env_get_str, env_get_bytes, env_get_int
|
|
8
8
|
)
|
|
9
|
-
from pypomes_db import DbEngine
|
|
9
|
+
from pypomes_db import DbEngine
|
|
10
10
|
from secrets import token_bytes
|
|
11
|
-
from sys import stderr
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
# recommended: allow the encode and decode keys to be generated anew when app starts
|
|
@@ -57,29 +56,9 @@ class JwtDbConfig(Enum):
|
|
|
57
56
|
Parameters for JWT databse connection.
|
|
58
57
|
"""
|
|
59
58
|
ENGINE: str = DbEngine(env_get_str(key=f"{APP_PREFIX}_JWT_DB_ENGINE"))
|
|
60
|
-
CLIENT: str = env_get_str(key=f"{APP_PREFIX}_JWT_DB_CLIENT") # for Oracle, only
|
|
61
|
-
DRIVER: str = env_get_str(key=f"{APP_PREFIX}_JWT_DB_DRIVER") # for SQLServer, only
|
|
62
|
-
NAME: str = env_get_str(key=f"{APP_PREFIX}_JWT_DB_NAME")
|
|
63
|
-
HOST: str = env_get_str(key=f"{APP_PREFIX}_JWT_DB_HOST")
|
|
64
|
-
PORT: int = env_get_int(key=f"{APP_PREFIX}_JWT_DB_PORT")
|
|
65
|
-
USER: str = env_get_str(key=f"{APP_PREFIX}_JWT_DB_USER")
|
|
66
|
-
PWD: str = env_get_str(key=f"{APP_PREFIX}_JWT_DB_PWD")
|
|
67
59
|
TABLE: str = env_get_str(key=f"{APP_PREFIX}_JWT_DB_TABLE")
|
|
68
60
|
COL_ACCOUNT: str = env_get_str(key=f"{APP_PREFIX}_JWT_DB_COL_ACCOUNT")
|
|
69
61
|
COL_ALGORITHM: str = env_get_str(key=f"{APP_PREFIX}_JWT_DB_COL_ALGORITHM")
|
|
70
62
|
COL_DECODER: str = env_get_str(key=f"{APP_PREFIX}_JWT_DB_COL_DECODER")
|
|
71
63
|
COL_KID: str = env_get_str(key=f"{APP_PREFIX}_JWT_DB_COL_KID")
|
|
72
64
|
COL_TOKEN: str = env_get_str(key=f"{APP_PREFIX}_JWT_DB_COL_TOKEN")
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
# define and validate the database engine
|
|
76
|
-
# noinspection PyTypeChecker
|
|
77
|
-
if not db_setup(engine=JwtDbConfig.ENGINE.value,
|
|
78
|
-
db_name=JwtDbConfig.NAME.value,
|
|
79
|
-
db_user=JwtDbConfig.USER.value,
|
|
80
|
-
db_pwd=JwtDbConfig.PWD.value,
|
|
81
|
-
db_host=JwtDbConfig.HOST.value,
|
|
82
|
-
db_port=JwtDbConfig.PORT.value,
|
|
83
|
-
db_client=JwtDbConfig.CLIENT.value,
|
|
84
|
-
db_driver=JwtDbConfig.DRIVER.value):
|
|
85
|
-
stderr.write("Invalid database parameters\n")
|
pypomes_jwt/jwt_pomes.py
CHANGED
|
@@ -185,6 +185,7 @@ def jwt_validate_token(errors: list[str] | None,
|
|
|
185
185
|
f"{JwtDbConfig.COL_DECODER.value} "
|
|
186
186
|
f"FROM {JwtDbConfig.TABLE.value}",
|
|
187
187
|
where_data=where_data,
|
|
188
|
+
engine=JwtDbConfig.ENGINE.value,
|
|
188
189
|
logger=logger)
|
|
189
190
|
if recs:
|
|
190
191
|
token_alg = recs[0][0]
|
|
@@ -283,6 +284,7 @@ def jwt_revoke_token(errors: list[str] | None,
|
|
|
283
284
|
JwtDbConfig.COL_KID.value: int(token_kid[1:]),
|
|
284
285
|
JwtDbConfig.COL_ACCOUNT.value: account_id
|
|
285
286
|
},
|
|
287
|
+
engine=JwtDbConfig.ENGINE.value,
|
|
286
288
|
logger=logger)
|
|
287
289
|
if op_errors:
|
|
288
290
|
if logger:
|
|
@@ -448,6 +450,7 @@ def jwt_refresh_tokens(errors: list[str] | None,
|
|
|
448
450
|
# start the database transaction
|
|
449
451
|
db_conn: Any = db_connect(errors=op_errors,
|
|
450
452
|
autocommit=False,
|
|
453
|
+
engine=JwtDbConfig.ENGINE.value,
|
|
451
454
|
logger=logger)
|
|
452
455
|
if db_conn:
|
|
453
456
|
# delete current refresh token
|
|
@@ -457,6 +460,7 @@ def jwt_refresh_tokens(errors: list[str] | None,
|
|
|
457
460
|
JwtDbConfig.COL_KID.value: int(token_kid[1:]),
|
|
458
461
|
JwtDbConfig.COL_ACCOUNT.value: account_id
|
|
459
462
|
},
|
|
463
|
+
engine=JwtDbConfig.ENGINE.value,
|
|
460
464
|
connection=db_conn,
|
|
461
465
|
committable=False,
|
|
462
466
|
logger=logger)
|
pypomes_jwt/jwt_registry.py
CHANGED
|
@@ -141,6 +141,7 @@ class JwtRegistry:
|
|
|
141
141
|
db_delete(errors=None,
|
|
142
142
|
delete_stmt=f"DELETE FROM {JwtDbConfig.value}",
|
|
143
143
|
where_data={JwtDbConfig.COL_ACCOUNT.value: account_id},
|
|
144
|
+
engine=JwtDbConfig.ENGINE.value,
|
|
144
145
|
logger=logger)
|
|
145
146
|
if logger:
|
|
146
147
|
if account_data:
|
|
@@ -282,6 +283,7 @@ class JwtRegistry:
|
|
|
282
283
|
# make sure to have a database connection
|
|
283
284
|
curr_conn: Any = db_conn or db_connect(errors=errors,
|
|
284
285
|
autocommit=False,
|
|
286
|
+
engine=JwtDbConfig.ENGINE.value,
|
|
285
287
|
logger=logger)
|
|
286
288
|
if curr_conn:
|
|
287
289
|
# persist the candidate token (may raise an exception)
|
|
@@ -299,6 +301,7 @@ class JwtRegistry:
|
|
|
299
301
|
update_stmt=f"UPDATE {JwtDbConfig.TABLE.value}",
|
|
300
302
|
update_data={JwtDbConfig.COL_TOKEN.value: refresh_token},
|
|
301
303
|
where_data={JwtDbConfig.COL_KID.value: token_id},
|
|
304
|
+
engine=JwtDbConfig.ENGINE.value,
|
|
302
305
|
connection=curr_conn,
|
|
303
306
|
committable=False,
|
|
304
307
|
logger=logger)
|
|
@@ -382,6 +385,7 @@ def _jwt_persist_token(account_id: str,
|
|
|
382
385
|
sel_stmt=f"SELECT {JwtDbConfig.COL_KID.value}, {JwtDbConfig.COL_TOKEN.value} "
|
|
383
386
|
f"FROM {JwtDbConfig.TABLE.value}",
|
|
384
387
|
where_data={JwtDbConfig.COL_ACCOUNT.value: account_id},
|
|
388
|
+
engine=JwtDbConfig.ENGINE.value,
|
|
385
389
|
connection=db_conn,
|
|
386
390
|
committable=False,
|
|
387
391
|
logger=logger)
|
|
@@ -424,6 +428,7 @@ def _jwt_persist_token(account_id: str,
|
|
|
424
428
|
db_delete(errors=errors,
|
|
425
429
|
delete_stmt=f"DELETE FROM {JwtDbConfig.TABLE.value}",
|
|
426
430
|
where_data={JwtDbConfig.COL_KID.value: expired},
|
|
431
|
+
engine=JwtDbConfig.ENGINE.value,
|
|
427
432
|
connection=db_conn,
|
|
428
433
|
committable=False,
|
|
429
434
|
logger=logger)
|
|
@@ -438,6 +443,7 @@ def _jwt_persist_token(account_id: str,
|
|
|
438
443
|
db_delete(errors=errors,
|
|
439
444
|
delete_stmt=f"DELETE FROM {JwtDbConfig.TABLE.value}",
|
|
440
445
|
where_data={JwtDbConfig.COL_KID.value: oldest_id},
|
|
446
|
+
engine=JwtDbConfig.ENGINE.value,
|
|
441
447
|
connection=db_conn,
|
|
442
448
|
committable=False,
|
|
443
449
|
logger=logger)
|
|
@@ -455,6 +461,7 @@ def _jwt_persist_token(account_id: str,
|
|
|
455
461
|
JwtDbConfig.COL_ALGORITHM.value: JwtConfig.DEFAULT_ALGORITHM.value,
|
|
456
462
|
JwtDbConfig.COL_DECODER.value: urlsafe_b64encode(s=JwtConfig.DECODING_KEY.value).decode()
|
|
457
463
|
},
|
|
464
|
+
engine=JwtDbConfig.ENGINE.value,
|
|
458
465
|
connection=db_conn,
|
|
459
466
|
committable=False,
|
|
460
467
|
logger=logger)
|
|
@@ -473,6 +480,7 @@ def _jwt_persist_token(account_id: str,
|
|
|
473
480
|
where_clause=where_clause,
|
|
474
481
|
where_data={JwtDbConfig.COL_ACCOUNT.value: account_id},
|
|
475
482
|
require_count=1,
|
|
483
|
+
engine=JwtDbConfig.ENGINE.value,
|
|
476
484
|
connection=db_conn,
|
|
477
485
|
committable=False,
|
|
478
486
|
logger=logger)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pypomes_jwt
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.3
|
|
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>=1.9.
|
|
15
|
+
Requires-Dist: pypomes-core>=1.9.9
|
|
16
16
|
Requires-Dist: pypomes-db>=2.0.9
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
pypomes_jwt/__init__.py,sha256=g4tjg7gt5_vwiHM_6-T6Ji4XYJ5py9RuzGmF2Z-qlXI,800
|
|
2
|
+
pypomes_jwt/jwt_configuration.py,sha256=mqTPblkfb4RXAzUe28T2gCk1auCYVY7gIlz2iFK4JSg,3127
|
|
3
|
+
pypomes_jwt/jwt_pomes.py,sha256=OkkzKc87eviEovAPIlGJlFlMIKooSivTB9LvX2137mg,23559
|
|
4
|
+
pypomes_jwt/jwt_registry.py,sha256=NEIYE15j4MnKaGVKp42WjriBzekvDZVTHFXP08EOcXA,23687
|
|
5
|
+
pypomes_jwt-1.1.3.dist-info/METADATA,sha256=dm8aTZMrvDbHxcpLvp07PDw1F_pZSef6DLeXnoVPqbo,632
|
|
6
|
+
pypomes_jwt-1.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
+
pypomes_jwt-1.1.3.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
|
|
8
|
+
pypomes_jwt-1.1.3.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
pypomes_jwt/__init__.py,sha256=g4tjg7gt5_vwiHM_6-T6Ji4XYJ5py9RuzGmF2Z-qlXI,800
|
|
2
|
-
pypomes_jwt/jwt_configuration.py,sha256=GBkt8ISgcRYMh1FuTxUBWiKFACHHz-67mejSaPdiEsc,4172
|
|
3
|
-
pypomes_jwt/jwt_pomes.py,sha256=e-E-T_hkk_FNmpsndee8AhcuUWR775SIxo4YBqjCFDA,23290
|
|
4
|
-
pypomes_jwt/jwt_registry.py,sha256=7eWFEdzCMXjdxwR8nO_rqAeZ6SDf-WAEksDlfLPM_o4,23212
|
|
5
|
-
pypomes_jwt-1.1.2.dist-info/METADATA,sha256=nIpMJ0AN-R9XZNsbEBVAu9ueTCOSQj3LxDgAOQrLKRU,632
|
|
6
|
-
pypomes_jwt-1.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
-
pypomes_jwt-1.1.2.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
|
|
8
|
-
pypomes_jwt-1.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|