pypomes-jwt 1.0.0__py3-none-any.whl → 1.0.1__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
@@ -36,45 +36,33 @@ def jwt_needed(func: callable) -> callable:
36
36
  return wrapper
37
37
 
38
38
 
39
- def jwt_verify_request(request: Request,
40
- logger: Logger = None) -> Response:
39
+ def jwt_verify_request(request: Request) -> Response:
41
40
  """
42
- Verify wheher the HTTP *request* has the proper authorization, as per the JWT standard.
41
+ Verify whether the HTTP *request* has the proper authorization, as per the JWT standard.
43
42
 
44
43
  :param request: the request to be verified
45
- :param logger: optional logger
46
44
  :return: *None* if the request is valid, otherwise a *Response* object reporting the error
47
45
  """
48
46
  # initialize the return variable
49
47
  result: Response | None = None
50
48
 
51
- if logger:
52
- logger.debug(msg="Validate a JWT token")
53
- err_msg: str | None = None
54
-
55
49
  # retrieve the authorization from the request header
56
50
  auth_header: str = request.headers.get("Authorization")
57
51
 
58
52
  # was a 'Bearer' authorization obtained ?
53
+ bad_token: bool = False
59
54
  if auth_header and auth_header.startswith("Bearer "):
60
55
  # yes, extract and validate the JWT access token
61
56
  token: str = auth_header.split(" ")[1]
62
- if logger:
63
- logger.debug(msg="Bearer token was retrieved")
64
57
  errors: list[str] = []
65
58
  jwt_validate_token(errors=errors,
66
59
  nature="A",
67
60
  token=token)
68
61
  if errors:
69
- err_msg = "; ".join(errors)
70
- else:
71
- # no 'Bearer' found, report the error
72
- err_msg = "Request header has no 'Bearer' data"
62
+ bad_token = True
73
63
 
74
- # log the error and deny the authorization
75
- if err_msg:
76
- if logger:
77
- logger.error(msg=err_msg)
64
+ # deny the authorization
65
+ if bad_token:
78
66
  result = Response(response="Authorization failed",
79
67
  status=401)
80
68
  return result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypomes_jwt
3
- Version: 1.0.0
3
+ Version: 1.0.1
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=UHDmdgmo_1XmHfLvrcxLNRrib6En_XlNEXElDiHlwlI,21188
4
+ pypomes_jwt/jwt_registry.py,sha256=5L6n4ue7YEkGT60U69WvoobKR9ziHkqdIgeOmYEn2gU,21472
5
+ pypomes_jwt-1.0.1.dist-info/METADATA,sha256=VgxvMpAJrWmoW5713vx2od7bYwvEyfaEjlGXTWjv-Vo,632
6
+ pypomes_jwt-1.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ pypomes_jwt-1.0.1.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
8
+ pypomes_jwt-1.0.1.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=zlMxCROxSLn-yLBRkoTQpiFsqQLJcjIXQEPMgePpkXc,21622
4
- pypomes_jwt/jwt_registry.py,sha256=5L6n4ue7YEkGT60U69WvoobKR9ziHkqdIgeOmYEn2gU,21472
5
- pypomes_jwt-1.0.0.dist-info/METADATA,sha256=jqAmlWUMTREyqVBQo5r_sG0LmatnBzM9Ze95VqARuiM,632
6
- pypomes_jwt-1.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- pypomes_jwt-1.0.0.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
8
- pypomes_jwt-1.0.0.dist-info/RECORD,,