pypomes-jwt 1.1.6__py3-none-any.whl → 1.1.7__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 +11 -5
- {pypomes_jwt-1.1.6.dist-info → pypomes_jwt-1.1.7.dist-info}/METADATA +2 -2
- pypomes_jwt-1.1.7.dist-info/RECORD +8 -0
- pypomes_jwt-1.1.6.dist-info/RECORD +0 -8
- {pypomes_jwt-1.1.6.dist-info → pypomes_jwt-1.1.7.dist-info}/WHEEL +0 -0
- {pypomes_jwt-1.1.6.dist-info → pypomes_jwt-1.1.7.dist-info}/licenses/LICENSE +0 -0
pypomes_jwt/jwt_pomes.py
CHANGED
|
@@ -38,6 +38,8 @@ def jwt_verify_request(request: Request) -> Response:
|
|
|
38
38
|
"""
|
|
39
39
|
Verify whether the HTTP *request* has the proper authorization, as per the JWT standard.
|
|
40
40
|
|
|
41
|
+
This implementation assumes that HTTP requests are handled with the *Flask* framework.
|
|
42
|
+
|
|
41
43
|
:param request: the *request* to be verified
|
|
42
44
|
:return: *None* if the *request* is valid, otherwise a *Response* reporting the error
|
|
43
45
|
"""
|
|
@@ -47,15 +49,19 @@ def jwt_verify_request(request: Request) -> Response:
|
|
|
47
49
|
# retrieve the authorization from the request header
|
|
48
50
|
auth_header: str = request.headers.get("Authorization")
|
|
49
51
|
|
|
50
|
-
#
|
|
52
|
+
# validate the authorization token
|
|
51
53
|
bad_token: bool = True
|
|
52
54
|
if auth_header and auth_header.startswith("Bearer "):
|
|
53
55
|
# yes, extract and validate the JWT access token
|
|
54
56
|
token: str = auth_header.split(" ")[1]
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
claims: dict[str, Any] = jwt_validate_token(errors=None,
|
|
58
|
+
token=token,
|
|
59
|
+
nature="A")
|
|
60
|
+
if claims:
|
|
61
|
+
login: str = request.values.get("login")
|
|
62
|
+
subject: str = claims["payload"].get("sub")
|
|
63
|
+
if not login or not subject or login == subject:
|
|
64
|
+
bad_token = False
|
|
59
65
|
|
|
60
66
|
# deny the authorization
|
|
61
67
|
if bad_token:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pypomes_jwt
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.7
|
|
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.5
|
|
16
16
|
Requires-Dist: pypomes-db>=2.1.1
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
pypomes_jwt/__init__.py,sha256=NZzjWKnhjxNuoE32V6soKo9sG5ypmt25V0mBAh3rAIs,793
|
|
2
|
+
pypomes_jwt/jwt_config.py,sha256=mtihd58_O00FuFXcNBKsabftG6UHu3Cj24i6cZXoskc,3096
|
|
3
|
+
pypomes_jwt/jwt_pomes.py,sha256=wplcnbC1RGgfJ1VlFpRVtSXTSRfthEjqGec7S1CWHis,23858
|
|
4
|
+
pypomes_jwt/jwt_registry.py,sha256=Zfhv5bn53UcSPuPSHns4AVMv7izrzd75HPp5eId2dck,21993
|
|
5
|
+
pypomes_jwt-1.1.7.dist-info/METADATA,sha256=I9h4WUglqMoy7a_1uwwnG9FPi4DosV9NVZ_O1afJD7Q,632
|
|
6
|
+
pypomes_jwt-1.1.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
+
pypomes_jwt-1.1.7.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
|
|
8
|
+
pypomes_jwt-1.1.7.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
pypomes_jwt/__init__.py,sha256=NZzjWKnhjxNuoE32V6soKo9sG5ypmt25V0mBAh3rAIs,793
|
|
2
|
-
pypomes_jwt/jwt_config.py,sha256=mtihd58_O00FuFXcNBKsabftG6UHu3Cj24i6cZXoskc,3096
|
|
3
|
-
pypomes_jwt/jwt_pomes.py,sha256=5d7xd0mCRbBZ65k0pMNeiF_UaZu5sfAojZDEs_wOT8Y,23509
|
|
4
|
-
pypomes_jwt/jwt_registry.py,sha256=Zfhv5bn53UcSPuPSHns4AVMv7izrzd75HPp5eId2dck,21993
|
|
5
|
-
pypomes_jwt-1.1.6.dist-info/METADATA,sha256=eTbk1Zi0snGQA9NAmmOW_pS0LwTWC5QFPNAYbu2LGNg,632
|
|
6
|
-
pypomes_jwt-1.1.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
-
pypomes_jwt-1.1.6.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
|
|
8
|
-
pypomes_jwt-1.1.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|