pypomes-jwt 0.5.6__py3-none-any.whl → 0.5.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 CHANGED
@@ -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 point to 'jwt_service()' below
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) -> Response:
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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypomes_jwt
3
- Version: 0.5.6
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
@@ -0,0 +1,7 @@
1
+ pypomes_jwt/__init__.py,sha256=1IyBb94cZjkXMibHrH_vh043b06QFh5UQ6HTYSDau28,978
2
+ pypomes_jwt/jwt_data.py,sha256=5W8HjdX5lVHvDkaDmOEARgwmp7GFPCX-c_iYjB6eUrQ,17397
3
+ pypomes_jwt/jwt_pomes.py,sha256=sSYfgrh3Mnz3bddTjCvA-_FZWAaeqiHA9yMKkoPVO7M,11255
4
+ pypomes_jwt-0.5.7.dist-info/METADATA,sha256=859iRwQR97JIEQ85PGQOieETPdcHOSUcr5hDhNX34HM,596
5
+ pypomes_jwt-0.5.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ pypomes_jwt-0.5.7.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
7
+ pypomes_jwt-0.5.7.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- pypomes_jwt/__init__.py,sha256=1IyBb94cZjkXMibHrH_vh043b06QFh5UQ6HTYSDau28,978
2
- pypomes_jwt/jwt_data.py,sha256=5W8HjdX5lVHvDkaDmOEARgwmp7GFPCX-c_iYjB6eUrQ,17397
3
- pypomes_jwt/jwt_pomes.py,sha256=ABtPGlxgSwvjOZYFN1qc-K9Vm56VesTSfOVrHkupG1A,10983
4
- pypomes_jwt-0.5.6.dist-info/METADATA,sha256=Fqzs9CkzSUzfpigvcC7xjNjZWxrmIx1RhsprCm_XBy4,596
5
- pypomes_jwt-0.5.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
- pypomes_jwt-0.5.6.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
7
- pypomes_jwt-0.5.6.dist-info/RECORD,,