pypomes-jwt 1.2.7__tar.gz → 1.2.8__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.2.7
3
+ Version: 1.2.8
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
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.12
13
13
  Requires-Dist: cryptography>=45.0.6
14
- Requires-Dist: flask>=3.1.1
14
+ Requires-Dist: flask>=3.1.2
15
15
  Requires-Dist: pyjwt>=2.10.1
16
16
  Requires-Dist: pypomes-core>=2.7.0
17
- Requires-Dist: pypomes-db>=2.5.7
17
+ Requires-Dist: pypomes-db>=2.5.8
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "pypomes_jwt"
9
- version = "1.2.7"
9
+ version = "1.2.8"
10
10
  authors = [
11
11
  { name="GT Nunes", email="wisecoder01@gmail.com" }
12
12
  ]
@@ -20,10 +20,10 @@ classifiers = [
20
20
  ]
21
21
  dependencies = [
22
22
  "cryptography>=45.0.6",
23
- "Flask>=3.1.1",
23
+ "Flask>=3.1.2",
24
24
  "PyJWT>=2.10.1",
25
25
  "pypomes_core>=2.7.0",
26
- "pypomes_db>=2.5.7"
26
+ "pypomes_db>=2.5.8"
27
27
  ]
28
28
 
29
29
  [project.urls]
@@ -6,7 +6,7 @@ from logging import Logger
6
6
  from pypomes_core import exc_format
7
7
  from pypomes_db import (
8
8
  DbEngine, db_connect, db_commit,
9
- db_rollback, db_select, db_delete
9
+ db_rollback, db_close, db_select, db_delete
10
10
  )
11
11
  from typing import Any
12
12
 
@@ -254,18 +254,18 @@ def jwt_validate_token(token: str,
254
254
  return result
255
255
 
256
256
 
257
- def jwt_revoke_token(errors: list[str] | None,
258
- account_id: str,
257
+ def jwt_revoke_token(account_id: str,
259
258
  token: str,
259
+ errors: list[str] = None,
260
260
  logger: Logger = None) -> bool:
261
261
  """
262
262
  Revoke the *refresh_token* associated with *account_id*.
263
263
 
264
264
  Revoke operations require access to a database table defined by *JWT_DB_TABLE*.
265
265
 
266
- :param errors: incidental error messages
267
266
  :param account_id: the account identification
268
267
  :param token: the token to be revoked
268
+ :param errors: incidental error messages
269
269
  :param logger: optional logger
270
270
  :return: *True* if operation could be performed, *False* otherwise
271
271
  """
@@ -285,13 +285,13 @@ def jwt_revoke_token(errors: list[str] | None,
285
285
  if token_kid[0:1] not in ["A", "R"]:
286
286
  op_errors.append("Invalid token")
287
287
  else:
288
- db_delete(errors=op_errors,
289
- delete_stmt=f"DELETE FROM {JwtDbConfig.TABLE}",
288
+ db_delete(delete_stmt=f"DELETE FROM {JwtDbConfig.TABLE}",
290
289
  where_data={
291
290
  JwtDbConfig.COL_KID: int(token_kid[1:]),
292
291
  JwtDbConfig.COL_ACCOUNT: account_id
293
292
  },
294
293
  engine=DbEngine(JwtDbConfig.ENGINE),
294
+ errors=op_errors,
295
295
  logger=logger)
296
296
  if op_errors:
297
297
  if logger:
@@ -304,12 +304,12 @@ def jwt_revoke_token(errors: list[str] | None,
304
304
  return result
305
305
 
306
306
 
307
- def jwt_issue_token(errors: list[str] | None,
308
- account_id: str,
307
+ def jwt_issue_token(account_id: str,
309
308
  nature: str,
310
309
  duration: int,
311
310
  lead_interval: int = None,
312
311
  claims: dict[str, Any] = None,
312
+ errors: list[str] = None,
313
313
  logger: Logger = None) -> str:
314
314
  """
315
315
  Issue or refresh, and return, a JWT token associated with *account_id*, of the specified *nature*.
@@ -319,12 +319,12 @@ def jwt_issue_token(errors: list[str] | None,
319
319
  The parameter *duration* specifies the token's validity interval (at least 60 seconds).
320
320
  These claims are ignored, if specified in *claims*: *iat*, *iss*, *exp*, *jti*, *nbf*, and *sub*.
321
321
 
322
- :param errors: incidental error messages
323
322
  :param account_id: the account identification
324
323
  :param nature: the token's nature, must be a single letter in the range *[B-Z]*, less *R*
325
324
  :param duration: the number of seconds for the token to remain valid (at least 60 seconds)
326
325
  :param claims: optional token's claims
327
326
  :param lead_interval: optional interval for the token to become active (in seconds)
327
+ :param errors: incidental error messages
328
328
  :param logger: optional logger
329
329
  :return: the JWT token data, or *None* if error
330
330
  """
@@ -358,9 +358,9 @@ def jwt_issue_token(errors: list[str] | None,
358
358
  return result
359
359
 
360
360
 
361
- def jwt_issue_tokens(errors: list[str] | None,
362
- account_id: str,
361
+ def jwt_issue_tokens(account_id: str,
363
362
  account_claims: dict[str, Any] = None,
363
+ errors: list[str] = None,
364
364
  logger: Logger = None) -> dict[str, Any]:
365
365
  """
366
366
  Issue the JWT token pair associated with *account_id*, for access and refresh operations.
@@ -376,9 +376,9 @@ def jwt_issue_tokens(errors: list[str] | None,
376
376
  "refresh-token": <jwt-token>
377
377
  }
378
378
 
379
- :param errors: incidental error messages
380
379
  :param account_id: the account identification
381
380
  :param account_claims: if provided, may supercede currently registered account-related claims
381
+ :param errors: incidental error messages
382
382
  :param logger: optional logger
383
383
  :return: the JWT token data, or *None* if error
384
384
  """
@@ -412,9 +412,9 @@ def jwt_issue_tokens(errors: list[str] | None,
412
412
  return result
413
413
 
414
414
 
415
- def jwt_refresh_tokens(errors: list[str] | None,
416
- account_id: str,
415
+ def jwt_refresh_tokens(account_id: str,
417
416
  refresh_token: str,
417
+ errors: list[str] = None,
418
418
  logger: Logger = None) -> dict[str, Any]:
419
419
  """
420
420
  Refresh the JWT token pair associated with *account_id*, for access and refresh operations.
@@ -497,6 +497,8 @@ def jwt_refresh_tokens(errors: list[str] | None,
497
497
  db_commit(connection=db_conn,
498
498
  errors=op_errors,
499
499
  logger=logger)
500
+ db_close(connection=db_conn,
501
+ logger=logger)
500
502
  else:
501
503
  # refresh token not found
502
504
  op_errors.append("Refresh token was not provided")
File without changes
File without changes
File without changes