pypomes-jwt 1.3.4__tar.gz → 1.3.6__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.4
3
+ Version: 1.3.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
@@ -10,8 +10,8 @@ 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
17
+ Requires-Dist: pypomes-db>=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.4"
9
+ version = "1.3.6"
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,6 +43,7 @@ elif not _encoding_key or not _decoding_key:
43
43
  format=serialization.PublicFormat.SubjectPublicKeyInfo)
44
44
 
45
45
 
46
+ # HAZARD: instances uses must be '.value' qualified, as this is not a subclass of either 'StrEnum' or 'IntEnum'
46
47
  class JwtConfig(Enum):
47
48
  """
48
49
  Parameters for JWT token issuance.
@@ -63,7 +63,7 @@ def provider_register(provider_id: str,
63
63
 
64
64
 
65
65
  def provider_get_token(provider_id: str,
66
- errors: list[str] | None,
66
+ errors: list[str] = None,
67
67
  logger: Logger = None) -> str | None:
68
68
  """
69
69
  Obtain an authentication token from the external provider *provider_id*.
@@ -96,12 +96,12 @@ def provider_get_token(provider_id: str,
96
96
  try:
97
97
  # typical return on a token request:
98
98
  # {
99
- # "token_type": "bearer",
99
+ # "token_type": "Bearer",
100
100
  # "access_token": <str>,
101
101
  # "expires_in": <number-of-seconds>,
102
102
  # optional data:
103
103
  # "refresh_token": <str>,
104
- # "refresh_expires_in": <nomber-of-seconds>
104
+ # "refresh_expires_in": <number-of-seconds>
105
105
  # }
106
106
  response: Response = requests.post(url=url,
107
107
  data=body_data,
@@ -116,8 +116,7 @@ def provider_get_token(provider_id: str,
116
116
  provider["token"] = reply.get("access_token")
117
117
  provider["expiration"] = now + int(reply.get("expires_in"))
118
118
  if logger:
119
- logger.debug(msg=f"POST '{url}': status "
120
- f"{response.status_code}, reason '{response.reason}')")
119
+ logger.debug(msg=f"POST '{url}': status {response.status_code}")
121
120
  except Exception as e:
122
121
  # the operation raised an exception
123
122
  err_msg = exc_format(exc=e,
@@ -203,8 +203,8 @@ class JwtRegistry:
203
203
 
204
204
  # may raise an exception
205
205
  return jwt.encode(payload=current_claims,
206
- key=JwtConfig.ENCODING_KEY,
207
- algorithm=JwtConfig.DEFAULT_ALGORITHM,
206
+ key=JwtConfig.ENCODING_KEY.value,
207
+ algorithm=JwtConfig.DEFAULT_ALGORITHM.value,
208
208
  headers={"kid": nature})
209
209
 
210
210
  def issue_tokens(self,
@@ -258,8 +258,8 @@ class JwtRegistry:
258
258
  current_claims["exp"] = just_now + account_data.get("refresh-max-age")
259
259
  # may raise an exception
260
260
  refresh_token: str = jwt.encode(payload=current_claims,
261
- key=JwtConfig.ENCODING_KEY,
262
- algorithm=JwtConfig.DEFAULT_ALGORITHM,
261
+ key=JwtConfig.ENCODING_KEY.value,
262
+ algorithm=JwtConfig.DEFAULT_ALGORITHM.value,
263
263
  headers={"kid": "R0"})
264
264
 
265
265
  # make sure to have a database connection
@@ -275,8 +275,8 @@ class JwtRegistry:
275
275
  logger=logger)
276
276
  # issue the definitive refresh token
277
277
  refresh_token = jwt.encode(payload=current_claims,
278
- key=JwtConfig.ENCODING_KEY,
279
- algorithm=JwtConfig.DEFAULT_ALGORITHM,
278
+ key=JwtConfig.ENCODING_KEY.value,
279
+ algorithm=JwtConfig.DEFAULT_ALGORITHM.value,
280
280
  headers={"kid": f"R{token_id}"})
281
281
  # persist it
282
282
  db_update(update_stmt=f"UPDATE {JwtDbConfig.TABLE}",
@@ -305,8 +305,8 @@ class JwtRegistry:
305
305
  current_claims["exp"] = just_now + account_data.get("access-max-age")
306
306
  # may raise an exception
307
307
  access_token: str = jwt.encode(payload=current_claims,
308
- key=JwtConfig.ENCODING_KEY,
309
- algorithm=JwtConfig.DEFAULT_ALGORITHM,
308
+ key=JwtConfig.ENCODING_KEY.value,
309
+ algorithm=JwtConfig.DEFAULT_ALGORITHM.value,
310
310
  headers={"kid": f"A{token_id}"})
311
311
  # return the token data
312
312
  return {
@@ -438,7 +438,7 @@ class JwtRegistry:
438
438
  JwtDbConfig.COL_ACCOUNT: account_id,
439
439
  JwtDbConfig.COL_TOKEN: jwt_token,
440
440
  JwtDbConfig.COL_ALGORITHM:
441
- JwtConfig.DEFAULT_ALGORITHM,
441
+ JwtConfig.DEFAULT_ALGORITHM.value,
442
442
  JwtDbConfig.COL_DECODER:
443
443
  b64encode(s=JwtConfig.DECODING_KEY.value).decode()
444
444
  },
File without changes
File without changes
File without changes