pypomes-jwt 0.5.6__tar.gz → 0.5.7__tar.gz
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-0.5.6 → pypomes_jwt-0.5.7}/PKG-INFO +1 -1
- {pypomes_jwt-0.5.6 → pypomes_jwt-0.5.7}/pyproject.toml +1 -1
- {pypomes_jwt-0.5.6 → pypomes_jwt-0.5.7}/src/pypomes_jwt/jwt_pomes.py +11 -6
- {pypomes_jwt-0.5.6 → pypomes_jwt-0.5.7}/.gitignore +0 -0
- {pypomes_jwt-0.5.6 → pypomes_jwt-0.5.7}/LICENSE +0 -0
- {pypomes_jwt-0.5.6 → pypomes_jwt-0.5.7}/README.md +0 -0
- {pypomes_jwt-0.5.6 → pypomes_jwt-0.5.7}/src/__init__.py +0 -0
- {pypomes_jwt-0.5.6 → pypomes_jwt-0.5.7}/src/pypomes_jwt/__init__.py +0 -0
- {pypomes_jwt-0.5.6 → pypomes_jwt-0.5.7}/src/pypomes_jwt/jwt_data.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pypomes_jwt
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.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
|
|
@@ -16,7 +16,7 @@ JWT_REFRESH_MAX_AGE: Final[int] = env_get_int(key=f"{APP_PREFIX}_JWT_REFRESH_MAX
|
|
|
16
16
|
def_value=43200)
|
|
17
17
|
JWT_HS_SECRET_KEY: Final[bytes] = env_get_bytes(key=f"{APP_PREFIX}_JWT_HS_SECRET_KEY",
|
|
18
18
|
def_value=token_bytes(32))
|
|
19
|
-
# must
|
|
19
|
+
# must invoke 'jwt_service()' below
|
|
20
20
|
JWT_ENDPOINT_URL: Final[str] = env_get_str(key=f"{APP_PREFIX}_JWT_ENDPOINT_URL")
|
|
21
21
|
|
|
22
22
|
__priv_key: bytes = env_get_bytes(key=f"{APP_PREFIX}_JWT_RSA_PRIVATE_KEY")
|
|
@@ -224,10 +224,9 @@ def jwt_verify_request(request: Request,
|
|
|
224
224
|
return result
|
|
225
225
|
|
|
226
226
|
|
|
227
|
-
# @flask_app.route(rule="/jwt-service",
|
|
228
|
-
# methods=["POST"])
|
|
229
227
|
def jwt_service(service_url: str = None,
|
|
230
|
-
service_params: dict[str, Any] = None
|
|
228
|
+
service_params: dict[str, Any] = None,
|
|
229
|
+
logger: Logger = None) -> Response:
|
|
231
230
|
"""
|
|
232
231
|
Entry point for obtaining JWT tokens.
|
|
233
232
|
|
|
@@ -248,6 +247,7 @@ def jwt_service(service_url: str = None,
|
|
|
248
247
|
|
|
249
248
|
:param service_url: the JWT reference URL, alternatively passed in JSON
|
|
250
249
|
:param service_params: the optional JSON containing the request parameters (defaults to JSON in body)
|
|
250
|
+
:param logger: optional logger
|
|
251
251
|
:return: the requested JWT token, along with its duration.
|
|
252
252
|
"""
|
|
253
253
|
# declare the return variable
|
|
@@ -265,7 +265,8 @@ def jwt_service(service_url: str = None,
|
|
|
265
265
|
if not service_url:
|
|
266
266
|
service_url = params.get("service-url")
|
|
267
267
|
if service_url:
|
|
268
|
-
item_data: dict[str, dict[str, Any]] = __jwt_data.retrieve_access_data(service_url=service_url
|
|
268
|
+
item_data: dict[str, dict[str, Any]] = __jwt_data.retrieve_access_data(service_url=service_url,
|
|
269
|
+
logger=logger)
|
|
269
270
|
if item_data:
|
|
270
271
|
valid = True
|
|
271
272
|
custom_claims: dict[str, Any] = item_data.get("custom-claims")
|
|
@@ -277,9 +278,13 @@ def jwt_service(service_url: str = None,
|
|
|
277
278
|
# obtain the token data
|
|
278
279
|
if valid:
|
|
279
280
|
try:
|
|
280
|
-
token_data: dict[str, Any] = __jwt_data.get_token_data(service_url=service_url
|
|
281
|
+
token_data: dict[str, Any] = __jwt_data.get_token_data(service_url=service_url,
|
|
282
|
+
logger=logger)
|
|
281
283
|
result = jsonify(token_data)
|
|
282
284
|
except Exception as e:
|
|
285
|
+
# validation failed
|
|
286
|
+
if logger:
|
|
287
|
+
logger.error(msg=str(e))
|
|
283
288
|
result = Response(response=str(e),
|
|
284
289
|
status=401)
|
|
285
290
|
else:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|