pypomes-jwt 1.3.5__tar.gz → 1.3.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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypomes_jwt
3
- Version: 1.3.5
3
+ Version: 1.3.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
@@ -10,8 +10,7 @@ Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Operating System :: OS Independent
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.12
13
- Requires-Dist: cryptography>=45.0.7
13
+ Requires-Dist: cryptography>=46.0.2
14
14
  Requires-Dist: flask>=3.1.2
15
15
  Requires-Dist: pyjwt>=2.10.1
16
- Requires-Dist: pypomes-core>=2.7.0
17
- Requires-Dist: pypomes-db>=2.7.5
16
+ Requires-Dist: pypomes-core>=2.7.6
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "pypomes_jwt"
9
- version = "1.3.5"
9
+ version = "1.3.7"
10
10
  authors = [
11
11
  { name="GT Nunes", email="wisecoder01@gmail.com" }
12
12
  ]
@@ -19,11 +19,11 @@ classifiers = [
19
19
  "Operating System :: OS Independent"
20
20
  ]
21
21
  dependencies = [
22
- "cryptography>=45.0.7",
22
+ "cryptography>=46.0.2",
23
23
  "Flask>=3.1.2",
24
24
  "PyJWT>=2.10.1",
25
- "pypomes_core>=2.7.0",
26
- "pypomes_db>=2.7.5"
25
+ "pypomes_core>=2.7.6"
26
+ # "pypomes_db>=2.7.6"
27
27
  ]
28
28
 
29
29
  [project.urls]
@@ -43,7 +43,7 @@ elif not _encoding_key or not _decoding_key:
43
43
  format=serialization.PublicFormat.SubjectPublicKeyInfo)
44
44
 
45
45
 
46
- # HAZARD: instances must be '.value' qualified, as this is not a subclass of either 'StrEnum' or 'IntEnum'
46
+ # HAZARD: instances uses must be '.value' qualified, as this is not a subclass of either 'StrEnum' or 'IntEnum'
47
47
  class JwtConfig(Enum):
48
48
  """
49
49
  Parameters for JWT token issuance.
@@ -66,14 +66,22 @@ del _encoding_key
66
66
  del _default_algorithm
67
67
 
68
68
 
69
+ # database access is not be necessary, if handling only externally provided JWT tokens
69
70
  class JwtDbConfig(StrEnum):
70
71
  """
71
72
  Parameters for JWT database connection.
72
73
  """
73
- ENGINE = env_get_str(key=f"{APP_PREFIX}_JWT_DB_ENGINE")
74
- TABLE = env_get_str(key=f"{APP_PREFIX}_JWT_DB_TABLE")
75
- COL_ACCOUNT = env_get_str(key=f"{APP_PREFIX}_JWT_DB_COL_ACCOUNT")
76
- COL_ALGORITHM = env_get_str(key=f"{APP_PREFIX}_JWT_DB_COL_ALGORITHM")
77
- COL_DECODER = env_get_str(key=f"{APP_PREFIX}_JWT_DB_COL_DECODER")
78
- COL_KID = env_get_str(key=f"{APP_PREFIX}_JWT_DB_COL_KID")
79
- COL_TOKEN = env_get_str(key=f"{APP_PREFIX}_JWT_DB_COL_TOKEN")
74
+ ENGINE = env_get_str(key=f"{APP_PREFIX}_JWT_DB_ENGINE",
75
+ def_value="")
76
+ TABLE = env_get_str(key=f"{APP_PREFIX}_JWT_DB_TABLE",
77
+ def_value="")
78
+ COL_ACCOUNT = env_get_str(key=f"{APP_PREFIX}_JWT_DB_COL_ACCOUNT",
79
+ def_value="")
80
+ COL_ALGORITHM = env_get_str(key=f"{APP_PREFIX}_JWT_DB_COL_ALGORITHM",
81
+ def_value="")
82
+ COL_DECODER = env_get_str(key=f"{APP_PREFIX}_JWT_DB_COL_DECODER",
83
+ def_value="")
84
+ COL_KID = env_get_str(key=f"{APP_PREFIX}_JWT_DB_COL_KID",
85
+ def_value="")
86
+ COL_TOKEN = env_get_str(key=f"{APP_PREFIX}_JWT_DB_COL_TOKEN",
87
+ def_value="")
@@ -4,7 +4,6 @@ from base64 import b64encode
4
4
  from datetime import datetime
5
5
  from logging import Logger
6
6
  from pypomes_core import TZ_LOCAL, exc_format
7
- from requests import Response
8
7
  from typing import Any
9
8
 
10
9
  # structure:
@@ -63,7 +62,7 @@ def provider_register(provider_id: str,
63
62
 
64
63
 
65
64
  def provider_get_token(provider_id: str,
66
- errors: list[str] | None,
65
+ errors: list[str] = None,
67
66
  logger: Logger = None) -> str | None:
68
67
  """
69
68
  Obtain an authentication token from the external provider *provider_id*.
@@ -96,17 +95,17 @@ def provider_get_token(provider_id: str,
96
95
  try:
97
96
  # typical return on a token request:
98
97
  # {
99
- # "token_type": "bearer",
98
+ # "token_type": "Bearer",
100
99
  # "access_token": <str>,
101
100
  # "expires_in": <number-of-seconds>,
102
101
  # optional data:
103
102
  # "refresh_token": <str>,
104
- # "refresh_expires_in": <nomber-of-seconds>
103
+ # "refresh_expires_in": <number-of-seconds>
105
104
  # }
106
- response: Response = requests.post(url=url,
107
- data=body_data,
108
- headers=headers_data,
109
- timeout=None)
105
+ response: requests.Response = requests.post(url=url,
106
+ data=body_data,
107
+ headers=headers_data,
108
+ timeout=None)
110
109
  if response.status_code < 200 or response.status_code >= 300:
111
110
  # request resulted in error, report the problem
112
111
  err_msg = (f"POST '{url}': failed, "
@@ -116,8 +115,7 @@ def provider_get_token(provider_id: str,
116
115
  provider["token"] = reply.get("access_token")
117
116
  provider["expiration"] = now + int(reply.get("expires_in"))
118
117
  if logger:
119
- logger.debug(msg=f"POST '{url}': status "
120
- f"{response.status_code}, reason '{response.reason}')")
118
+ logger.debug(msg=f"POST '{url}': status {response.status_code}")
121
119
  except Exception as e:
122
120
  # the operation raised an exception
123
121
  err_msg = exc_format(exc=e,
File without changes
File without changes
File without changes