pypomes-jwt 0.8.6__py3-none-any.whl → 0.8.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_constants.py +2 -1
- pypomes_jwt/jwt_data.py +6 -5
- pypomes_jwt/jwt_pomes.py +4 -3
- {pypomes_jwt-0.8.6.dist-info → pypomes_jwt-0.8.8.dist-info}/METADATA +2 -2
- pypomes_jwt-0.8.8.dist-info/RECORD +8 -0
- pypomes_jwt-0.8.6.dist-info/RECORD +0 -8
- {pypomes_jwt-0.8.6.dist-info → pypomes_jwt-0.8.8.dist-info}/WHEEL +0 -0
- {pypomes_jwt-0.8.6.dist-info → pypomes_jwt-0.8.8.dist-info}/licenses/LICENSE +0 -0
pypomes_jwt/jwt_constants.py
CHANGED
|
@@ -49,7 +49,8 @@ JWT_REFRESH_MAX_AGE: Final[int] = env_get_int(key=f"{APP_PREFIX}_JWT_REFRESH_MAX
|
|
|
49
49
|
JWT_ACCOUNT_LIMIT: Final[int] = env_get_int(key=f"{APP_PREFIX}_JWT_ACCOUNT_LIMIT")
|
|
50
50
|
|
|
51
51
|
# recommended: allow the encode and decode keys to be generated anew when app starts
|
|
52
|
-
__encoding_key: bytes = env_get_bytes(key=f"{APP_PREFIX}_JWT_ENCODE_KEY"
|
|
52
|
+
__encoding_key: bytes = env_get_bytes(key=f"{APP_PREFIX}_JWT_ENCODE_KEY",
|
|
53
|
+
encoding="base64url")
|
|
53
54
|
__decoding_key: bytes
|
|
54
55
|
if JWT_DEFAULT_ALGORITHM in ["HS256", "HS512"]:
|
|
55
56
|
if not __encoding_key:
|
pypomes_jwt/jwt_data.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import base64
|
|
1
2
|
import jwt
|
|
2
3
|
import requests
|
|
3
4
|
import string
|
|
@@ -35,8 +36,8 @@ class JwtData:
|
|
|
35
36
|
"token-audience": <string> # the audience the token is intended for
|
|
36
37
|
"token_nonce": <string> # value used to associate a client session with a token
|
|
37
38
|
"claims": {
|
|
38
|
-
"valid-from": <string> # token's start (<YYYY-MM-
|
|
39
|
-
"valid-until": <string> # token's finish (<YYYY-MM-
|
|
39
|
+
"valid-from": <string> # token's start (<YYYY-MM-DDThh:mm:ss+00:00>)
|
|
40
|
+
"valid-until": <string> # token's finish (<YYYY-MM-DDThh:mm:ss+00:00>)
|
|
40
41
|
"birthdate": <string>, # subject's birth date
|
|
41
42
|
"email": <string>, # subject's email
|
|
42
43
|
"gender": <string>, # subject's gender
|
|
@@ -68,8 +69,8 @@ class JwtData:
|
|
|
68
69
|
|
|
69
70
|
Account-related claims are optional claims, and convey information about the registered account they belong to.
|
|
70
71
|
Alhough they can be freely specified, these are some of the most commonly used claims:
|
|
71
|
-
"valid-from": <string> # token's start (<YYYY-MM-
|
|
72
|
-
"valid-until": <string> # token's finish (<YYYY-MM-
|
|
72
|
+
"valid-from": <string> # token's start (<YYYY-MM-DDThh:mm:ss+00:00>)
|
|
73
|
+
"valid-until": <string> # token's finish (<YYYY-MM-DDThh:mm:ss+00.00>)
|
|
73
74
|
"birthdate": <string> # subject's birth date
|
|
74
75
|
"email": <string> # subject's email
|
|
75
76
|
"gender": <string> # subject's gender
|
|
@@ -452,7 +453,7 @@ def _jwt_persist_token(errors: list[str],
|
|
|
452
453
|
insert_data={JWT_DB_COL_ACCOUNT: account_id,
|
|
453
454
|
JWT_DB_COL_TOKEN: jwt_token,
|
|
454
455
|
JWT_DB_COL_ALGORITHM: JWT_DEFAULT_ALGORITHM,
|
|
455
|
-
JWT_DB_COL_DECODER: JWT_DECODING_KEY.
|
|
456
|
+
JWT_DB_COL_DECODER: base64.urlsafe_b64encode(JWT_DECODING_KEY).decode()},
|
|
456
457
|
connection=db_conn,
|
|
457
458
|
logger=logger)
|
|
458
459
|
if errors:
|
pypomes_jwt/jwt_pomes.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import base64
|
|
1
2
|
import jwt
|
|
2
3
|
from flask import Request, Response, request
|
|
3
4
|
from logging import Logger
|
|
@@ -198,7 +199,7 @@ def jwt_validate_token(errors: list[str] | None,
|
|
|
198
199
|
logger=logger)
|
|
199
200
|
if recs:
|
|
200
201
|
token_alg = recs[0][0]
|
|
201
|
-
token_decoder =
|
|
202
|
+
token_decoder = base64.urlsafe_b64decode(recs[0][1])
|
|
202
203
|
else:
|
|
203
204
|
op_errors.append("Invalid token")
|
|
204
205
|
else:
|
|
@@ -382,8 +383,8 @@ def jwt_get_claims(errors: list[str] | None,
|
|
|
382
383
|
"kid": "1234"
|
|
383
384
|
},
|
|
384
385
|
"payload": {
|
|
385
|
-
"valid-from": <YYYY-MM-
|
|
386
|
-
"valid-until": <YYYY-MM-
|
|
386
|
+
"valid-from": <YYYY-MM-DDThh:mm:ss+00:00>
|
|
387
|
+
"valid-until": <YYYY-MM-DDThh:mm:ss+00:00>
|
|
387
388
|
"birthdate": "1980-01-01",
|
|
388
389
|
"email": "jdoe@mail.com",
|
|
389
390
|
"exp": 1516640454,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pypomes_jwt
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.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
|
|
@@ -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.8.
|
|
15
|
+
Requires-Dist: pypomes-core>=1.8.5
|
|
16
16
|
Requires-Dist: pypomes-db>=1.9.6
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
pypomes_jwt/__init__.py,sha256=P7rT6ZVE2BzU3ntYOr83H5iOf5JcCmjDUYakNbrRAP0,1266
|
|
2
|
+
pypomes_jwt/jwt_constants.py,sha256=fT9sak0ud_sE-5XRU9qMn7I4h4QS6CTG2Q7KCbrASw4,4041
|
|
3
|
+
pypomes_jwt/jwt_data.py,sha256=FU4zvFr-1ZbClM8ozt9asR2EGZe-xYX3046dxWnGays,22529
|
|
4
|
+
pypomes_jwt/jwt_pomes.py,sha256=MBwGxA1VvOS1E2t6CrhYrsXbOdG3LhHuPamjJkQjrJg,17224
|
|
5
|
+
pypomes_jwt-0.8.8.dist-info/METADATA,sha256=hMzfbkk3BKHgy4t3SAxPkO8WYK19NZBivzDCtIRbnjg,632
|
|
6
|
+
pypomes_jwt-0.8.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
+
pypomes_jwt-0.8.8.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
|
|
8
|
+
pypomes_jwt-0.8.8.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
pypomes_jwt/__init__.py,sha256=P7rT6ZVE2BzU3ntYOr83H5iOf5JcCmjDUYakNbrRAP0,1266
|
|
2
|
-
pypomes_jwt/jwt_constants.py,sha256=FA50jKQ3D09MxXkUpVkXW5IQqm_UX6qm3bU5gHvkU-4,3980
|
|
3
|
-
pypomes_jwt/jwt_data.py,sha256=CAgqM60167yg-wnJEhky5_lu4GxVwDj0Qk8doD7PrCk,22461
|
|
4
|
-
pypomes_jwt/jwt_pomes.py,sha256=BNL6r-IfnKKeBZFpTzFXQUnotFKgV6PeKHqar9Ys20I,17186
|
|
5
|
-
pypomes_jwt-0.8.6.dist-info/METADATA,sha256=I-8EBiC62CNBvRBO_GH4oyYfxMncBaOy-jfslBSCMzk,632
|
|
6
|
-
pypomes_jwt-0.8.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
-
pypomes_jwt-0.8.6.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
|
|
8
|
-
pypomes_jwt-0.8.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|