pypomes-jwt 0.4.8__py3-none-any.whl → 0.4.9__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/__init__.py +4 -4
- pypomes_jwt/jwt_pomes.py +16 -2
- {pypomes_jwt-0.4.8.dist-info → pypomes_jwt-0.4.9.dist-info}/METADATA +3 -3
- pypomes_jwt-0.4.9.dist-info/RECORD +7 -0
- pypomes_jwt-0.4.8.dist-info/RECORD +0 -7
- {pypomes_jwt-0.4.8.dist-info → pypomes_jwt-0.4.9.dist-info}/WHEEL +0 -0
- {pypomes_jwt-0.4.8.dist-info → pypomes_jwt-0.4.9.dist-info}/licenses/LICENSE +0 -0
pypomes_jwt/__init__.py
CHANGED
|
@@ -5,8 +5,8 @@ from .jwt_pomes import (
|
|
|
5
5
|
JWT_ENDPOINT_URL,
|
|
6
6
|
JWT_ACCESS_MAX_AGE, JWT_REFRESH_MAX_AGE,
|
|
7
7
|
JWT_HS_SECRET_KEY, JWT_RSA_PRIVATE_KEY, JWT_RSA_PUBLIC_KEY,
|
|
8
|
-
|
|
9
|
-
jwt_get_claims,
|
|
8
|
+
jwt_needed, jwt_verify_request,
|
|
9
|
+
jwt_get_claims, jwt_get_token, jwt_get_token_data,
|
|
10
10
|
jwt_service, jwt_set_service_access, jwt_remove_service_access
|
|
11
11
|
)
|
|
12
12
|
|
|
@@ -17,8 +17,8 @@ __all__ = [
|
|
|
17
17
|
"JWT_ENDPOINT_URL",
|
|
18
18
|
"JWT_ACCESS_MAX_AGE", "JWT_REFRESH_MAX_AGE",
|
|
19
19
|
"JWT_HS_SECRET_KEY", "JWT_RSA_PRIVATE_KEY", "JWT_RSA_PUBLIC_KEY",
|
|
20
|
-
"
|
|
21
|
-
"jwt_get_claims", "
|
|
20
|
+
"jwt_needed", "jwt_verify_request",
|
|
21
|
+
"jwt_get_claims", "jwt_get_token", "jwt_get_token_data",
|
|
22
22
|
"jwt_service", "jwt_set_service_access", "jwt_remove_service_access"
|
|
23
23
|
]
|
|
24
24
|
|
pypomes_jwt/jwt_pomes.py
CHANGED
|
@@ -30,6 +30,20 @@ JWT_RSA_PUBLIC_KEY: Final[str] = __pub_key
|
|
|
30
30
|
__jwt_data: JwtData = JwtData()
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
def jwt_needed(func: callable) -> callable:
|
|
34
|
+
"""
|
|
35
|
+
Create a decorator to authenticate service endpoints with JWT tokens.
|
|
36
|
+
|
|
37
|
+
:param func: the function being decorated
|
|
38
|
+
"""
|
|
39
|
+
# ruff: noqa: ANN003
|
|
40
|
+
def wrapper(*args, **kwargs) -> Response:
|
|
41
|
+
response: Response = jwt_verify_request(request=request) if JWT_ENDPOINT_URL else None
|
|
42
|
+
return response if response else func(*args, **kwargs)
|
|
43
|
+
|
|
44
|
+
return wrapper
|
|
45
|
+
|
|
46
|
+
|
|
33
47
|
def jwt_set_service_access(service_url: str,
|
|
34
48
|
claims: dict[str, Any],
|
|
35
49
|
algorithm: Literal["HS256", "HS512", "RSA256", "RSA512"] = JWT_DEFAULT_ALGORITHM,
|
|
@@ -206,14 +220,14 @@ def jwt_verify_request(request: Request,
|
|
|
206
220
|
status=401)
|
|
207
221
|
else:
|
|
208
222
|
# no, report the error
|
|
209
|
-
result = Response(response="Authorization failed
|
|
223
|
+
result = Response(response="Authorization failed",
|
|
210
224
|
status=401)
|
|
211
225
|
|
|
212
226
|
return result
|
|
213
227
|
|
|
214
228
|
|
|
215
229
|
# @flask_app.route(rule="/jwt-service",
|
|
216
|
-
# methods=["
|
|
230
|
+
# methods=["POST"])
|
|
217
231
|
def jwt_service(service_url: str = None) -> Response:
|
|
218
232
|
"""
|
|
219
233
|
Entry point for obtaining JWT tokens.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pypomes_jwt
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.9
|
|
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,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
12
|
Requires-Python: >=3.10
|
|
13
13
|
Requires-Dist: pip>=24.2
|
|
14
14
|
Requires-Dist: pyjwt>=2.9.0
|
|
15
|
-
Requires-Dist: pypomes-core>=1.5.
|
|
16
|
-
Requires-Dist: pypomes-crypto>=0.
|
|
15
|
+
Requires-Dist: pypomes-core>=1.5.3
|
|
16
|
+
Requires-Dist: pypomes-crypto>=0.3.0
|
|
17
17
|
Requires-Dist: setuptools>=75.1.0
|
|
18
18
|
Requires-Dist: wheel>=0.44.0
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
pypomes_jwt/__init__.py,sha256=1IyBb94cZjkXMibHrH_vh043b06QFh5UQ6HTYSDau28,978
|
|
2
|
+
pypomes_jwt/jwt_data.py,sha256=g8wnWYI7bueCIuK67eW2Uy21ALYk5RbLigUHwljjzt4,17496
|
|
3
|
+
pypomes_jwt/jwt_pomes.py,sha256=aPvoBhUqRCQ3yzXGab-RNvELLFlWvmZsDUNCas5VbDA,10950
|
|
4
|
+
pypomes_jwt-0.4.9.dist-info/METADATA,sha256=eb0MR5tHfoEGPmB9JjPOimSer5hwR5QRrU2j98Wsarg,687
|
|
5
|
+
pypomes_jwt-0.4.9.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
6
|
+
pypomes_jwt-0.4.9.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
|
|
7
|
+
pypomes_jwt-0.4.9.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
pypomes_jwt/__init__.py,sha256=wIbTPmnxyGFuSdawdyglNn7GVKEvPZ_57MF9HBbWclc,952
|
|
2
|
-
pypomes_jwt/jwt_data.py,sha256=g8wnWYI7bueCIuK67eW2Uy21ALYk5RbLigUHwljjzt4,17496
|
|
3
|
-
pypomes_jwt/jwt_pomes.py,sha256=j-JvK-neQ4bCWcFVk6jfCRoGRQUjDixs6PVfdvnICS8,10541
|
|
4
|
-
pypomes_jwt-0.4.8.dist-info/METADATA,sha256=xK6xa5JRtYwPuFGOBFSVcr96t0A03SkfZbJgIWwcpNk,687
|
|
5
|
-
pypomes_jwt-0.4.8.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
6
|
-
pypomes_jwt-0.4.8.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
|
|
7
|
-
pypomes_jwt-0.4.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|