pypomes-jwt 1.0.5__py3-none-any.whl → 1.0.6__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
@@ -52,16 +52,15 @@ def jwt_verify_request(request: Request) -> Response:
52
52
  auth_header: str = request.headers.get("Authorization")
53
53
 
54
54
  # was a 'Bearer' authorization obtained ?
55
- bad_token: bool = False
55
+ bad_token: bool = True
56
56
  if auth_header and auth_header.startswith("Bearer "):
57
57
  # yes, extract and validate the JWT access token
58
58
  token: str = auth_header.split(" ")[1]
59
59
  errors: list[str] = []
60
- jwt_validate_token(errors=errors,
61
- nature="A",
62
- token=token)
63
- if errors:
64
- bad_token = True
60
+ if jwt_validate_token(errors=errors,
61
+ nature="A",
62
+ token=token):
63
+ bad_token = False
65
64
 
66
65
  # deny the authorization
67
66
  if bad_token:
@@ -480,7 +479,7 @@ def jwt_refresh_tokens(errors: list[str] | None,
480
479
  logger.error(msg=f"Error refreshing the token pair: {exc_err}")
481
480
  op_errors.append(exc_err)
482
481
 
483
- # conclude the transaction
482
+ # wrap-up the transaction
484
483
  if op_errors:
485
484
  db_rollback(errors=op_errors,
486
485
  connection=db_conn,
@@ -308,7 +308,7 @@ class JwtRegistry:
308
308
  committable=False,
309
309
  logger=logger)
310
310
 
311
- # conclude the transaction
311
+ # wrap-up the transaction
312
312
  if not db_conn:
313
313
  if errors:
314
314
  db_rollback(errors=errors,
@@ -362,7 +362,7 @@ def _jwt_persist_token(account_id: str,
362
362
  db_conn: Any,
363
363
  logger: Logger = None) -> int:
364
364
  """
365
- Persist the given token, making sure that the account limit is adhered to.
365
+ Persist the given token, making sure that the account limit is complied with.
366
366
 
367
367
  The tokens in storage, associated with *account_id*, are examined for their expiration timestamp.
368
368
  If a token's expiration timestamp is in the past, it is removed from storage. If the maximum number
@@ -464,12 +464,12 @@ def _jwt_persist_token(account_id: str,
464
464
  if errors:
465
465
  raise RuntimeError("; ".join(errors))
466
466
 
467
- # obtain the token's storage id
468
- # HAZARD: JWT_DB_COL_TOKEN's type might prevent it for being used in a WHERE clause
467
+ # obtain and return the token's storage id
468
+ # HAZARD: JWT_DB_COL_TOKEN's column type might prevent it for being used in a WHERE clause
469
469
  where_clause: str | None = None
470
470
  if existing_ids:
471
- where_clause = f"{JWT_DB_COL_KID} NOT IN ({existing_ids})"
472
- where_clause = where_clause.replace("[", "").replace("]", "")
471
+ where_clause = f"{JWT_DB_COL_KID} NOT IN {existing_ids}"
472
+ where_clause = where_clause.replace("[", "(", 1).replace("]", ")", 1)
473
473
  reply: list[tuple[int]] = db_select(errors=errors,
474
474
  sel_stmt=f"SELECT {JWT_DB_COL_KID} "
475
475
  f"FROM {JWT_DB_TABLE}",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypomes_jwt
3
- Version: 1.0.5
3
+ Version: 1.0.6
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,8 @@
1
+ pypomes_jwt/__init__.py,sha256=fLr_M8yXlcmSTNPMdJOJQlMmtaiK5YKh0vKjOp3z2E4,1446
2
+ pypomes_jwt/jwt_constants.py,sha256=IQV39AiZKGuU8XxZBgJ-KJZQZ_mmnxyOnRZeuxlqDRk,4045
3
+ pypomes_jwt/jwt_pomes.py,sha256=eW9vvlCcDfIjgTVwJeE_EL8nwiBMe7Q4PlU7HRbn-rg,23038
4
+ pypomes_jwt/jwt_registry.py,sha256=S_-M6rcXwKy73H6uE4EwFx4F1gVfVg_DHCVYsqAbiWU,23005
5
+ pypomes_jwt-1.0.6.dist-info/METADATA,sha256=67io_BFb6EGOsKzibNWgi4QZWbLKos7iAiaHQQdJNm4,632
6
+ pypomes_jwt-1.0.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ pypomes_jwt-1.0.6.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
8
+ pypomes_jwt-1.0.6.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- pypomes_jwt/__init__.py,sha256=fLr_M8yXlcmSTNPMdJOJQlMmtaiK5YKh0vKjOp3z2E4,1446
2
- pypomes_jwt/jwt_constants.py,sha256=IQV39AiZKGuU8XxZBgJ-KJZQZ_mmnxyOnRZeuxlqDRk,4045
3
- pypomes_jwt/jwt_pomes.py,sha256=2LyjMMVkdPXeC7hMD52637e-LJoGbhKTb0Wqj6QXbTg,23049
4
- pypomes_jwt/jwt_registry.py,sha256=OgL4qH2WJdg0awtTRTk3jLP4oXB21PbEfDRzADTEhYI,22979
5
- pypomes_jwt-1.0.5.dist-info/METADATA,sha256=yRdOfyKQEeiDHaHjLmtpwiInVnl30f8228Gj2RoSP_0,632
6
- pypomes_jwt-1.0.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- pypomes_jwt-1.0.5.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
8
- pypomes_jwt-1.0.5.dist-info/RECORD,,