pypomes-jwt 0.8.0__py3-none-any.whl → 0.8.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.

@@ -47,7 +47,8 @@ JWT_DB_ENGINE: Final[DbEngine] = DbEngine(__db_engine) if __db_engine else None
47
47
 
48
48
  # one of HS256, HS512, RSA256, RSA512
49
49
  JWT_DEFAULT_ALGORITHM: Final[str] = env_get_str(key=f"{APP_PREFIX}_JWT_DEFAULT_ALGORITHM",
50
- def_value="HS256")
50
+ def_value="RS256")
51
+
51
52
  # recommended: between 5 min and 1 hour (set to 5 min)
52
53
  JWT_ACCESS_MAX_AGE: Final[int] = env_get_int(key=f"{APP_PREFIX}_JWT_ACCESS_MAX_AGE",
53
54
  def_value=300)
pypomes_jwt/jwt_data.py CHANGED
@@ -397,8 +397,9 @@ def _jwt_persist_token(errors: list[str],
397
397
  # ruff: noqa: S324
398
398
  hasher = hashlib.new(name="md5",
399
399
  data=jwt_token.encode())
400
- token_hash: str = hasher.digest().decode()
400
+ token_hash: str = hasher.digest().hex()
401
401
  db_insert(errors=errors,
402
402
  insert_stmt=f"INSERT INTO {JWT_DB_TABLE}",
403
- insert_data={"ds_hash": token_hash,
404
- "ds_token": jwt_token})
403
+ insert_data={JWT_DB_COL_ACCOUNT: account_id,
404
+ JWT_DB_COL_HASH: token_hash,
405
+ JWT_DB_COL_TOKEN: jwt_token})
pypomes_jwt/jwt_pomes.py CHANGED
@@ -7,7 +7,8 @@ from typing import Any, Literal
7
7
  from .jwt_constants import (
8
8
  JWT_ACCESS_MAX_AGE, JWT_REFRESH_MAX_AGE,
9
9
  JWT_DEFAULT_ALGORITHM, JWT_DECODING_KEY,
10
- JWT_DB_ENGINE, JWT_DB_TABLE, JWT_DB_COL_ACCOUNT, JWT_DB_COL_TOKEN
10
+ JWT_DB_ENGINE, JWT_DB_TABLE,
11
+ JWT_DB_COL_ACCOUNT, JWT_DB_COL_HASH, JWT_DB_COL_TOKEN
11
12
  )
12
13
  from .jwt_data import JwtData
13
14
 
@@ -226,14 +227,14 @@ def jwt_revoke_token(errors: list[str] | None,
226
227
  # ruff: noqa: S324
227
228
  hasher = hashlib.new(name="md5",
228
229
  data=refresh_token.encode())
229
- token_hash: str = hasher.digest().decode()
230
+ token_hash: str = hasher.digest().hex()
230
231
  if db_exists(errors=op_errors,
231
232
  table=JWT_DB_TABLE,
232
- where_data={"ds_hash": token_hash},
233
+ where_data={JWT_DB_COL_HASH: token_hash},
233
234
  logger=logger):
234
235
  db_delete(errors=errors,
235
236
  delete_stmt=f"DELETE FROM {JWT_DB_TABLE}",
236
- where_data={"ds_hash": token_hash},
237
+ where_data={JWT_DB_COL_HASH: token_hash},
237
238
  logger=logger)
238
239
  elif not op_errors:
239
240
  op_errors.append("Token was not found")
@@ -336,7 +337,7 @@ def jwt_get_claims(errors: list[str] | None,
336
337
  Structure of the returned data:
337
338
  {
338
339
  "header": {
339
- "alg": "HS256",
340
+ "alg": "RS256",
340
341
  "typ": "JWT",
341
342
  "kid": "rt466ytRTYH64577uydhDFGHDYJH2341"
342
343
  },
@@ -347,10 +348,10 @@ def jwt_get_claims(errors: list[str] | None,
347
348
  "iat": 1516239022,
348
349
  "iss": "https://my_id_provider/issue",
349
350
  "jti": "Uhsdfgr67FGH567qwSDF33er89retert",
350
- "gender": "M,
351
+ "gender": "M",
351
352
  "name": "John Doe",
352
353
  "nbt": 1516249022
353
- "sub": "1234567890",
354
+ "sub": "11111111111",
354
355
  "roles": [
355
356
  "administrator",
356
357
  "operator"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypomes_jwt
3
- Version: 0.8.0
3
+ Version: 0.8.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=06WdwiP2m5jtrFjpPSacg4fRd2Dh6gVo93xJhmu73J4,1134
2
+ pypomes_jwt/jwt_constants.py,sha256=EjdrTP5AptGoOdI0gzsxexmM4lrgm2r0KHX-DyyGhFc,4330
3
+ pypomes_jwt/jwt_data.py,sha256=q4KUVOuLXHA9tVIfuVEPo8uZPulElWM04wqtGVxcV-0,19239
4
+ pypomes_jwt/jwt_pomes.py,sha256=lACMvNHRVpGgOGmQJ67zbURnR6p4kcxU4UomoZYahto,15246
5
+ pypomes_jwt-0.8.1.dist-info/METADATA,sha256=g4cWSIxewY90pfkQ2gLJlLdE_LqHeX2E6mU2CfX0eak,599
6
+ pypomes_jwt-0.8.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ pypomes_jwt-0.8.1.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
8
+ pypomes_jwt-0.8.1.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- pypomes_jwt/__init__.py,sha256=06WdwiP2m5jtrFjpPSacg4fRd2Dh6gVo93xJhmu73J4,1134
2
- pypomes_jwt/jwt_constants.py,sha256=6-Jw4ORgf32hRWnaGyVISXMJMtTBk7LdKl3RrDy7Ll0,4328
3
- pypomes_jwt/jwt_data.py,sha256=gyhGquSQbHevOKIoXmAmjMSwCjXB7pYbI2sY-7sGGO8,19158
4
- pypomes_jwt/jwt_pomes.py,sha256=PPx-JTlR2dVsLUFlkCiZCxYOnH-BbwqpptBDHO_PIfI,15213
5
- pypomes_jwt-0.8.0.dist-info/METADATA,sha256=C2fRw5H6are30XZfHLK5IpyqNFlL59Kt9Z0VtJXF07E,599
6
- pypomes_jwt-0.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
- pypomes_jwt-0.8.0.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
8
- pypomes_jwt-0.8.0.dist-info/RECORD,,