pypomes-jwt 0.8.4__tar.gz → 0.8.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: 0.8.4
3
+ Version: 0.8.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
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "pypomes_jwt"
9
- version = "0.8.4"
9
+ version = "0.8.6"
10
10
  authors = [
11
11
  { name="GT Nunes", email="wisecoder01@gmail.com" }
12
12
  ]
@@ -35,12 +35,14 @@ class JwtData:
35
35
  "token-audience": <string> # the audience the token is intended for
36
36
  "token_nonce": <string> # value used to associate a client session with a token
37
37
  "claims": {
38
- "birthdate": <string>, # subject's birth date
39
- "email": <string>, # subject's email
40
- "gender": <string>, # subject's gender
41
- "name": <string>, # subject's name
42
- "roles": <List[str]>, # subject roles
43
- "nonce": <string>, # value used to associate a Client session with a token
38
+ "valid-from": <string> # token's start (<YYYY-MM-DD hh:mm:ss>)
39
+ "valid-until": <string> # token's finish (<YYYY-MM-DD hh:mm:ss>)
40
+ "birthdate": <string>, # subject's birth date
41
+ "email": <string>, # subject's email
42
+ "gender": <string>, # subject's gender
43
+ "name": <string>, # subject's name
44
+ "roles": <List[str]>, # subject roles
45
+ "nonce": <string>, # value used to associate a Client session with a token
44
46
  ...
45
47
  }
46
48
  },
@@ -66,6 +68,8 @@ class JwtData:
66
68
 
67
69
  Account-related claims are optional claims, and convey information about the registered account they belong to.
68
70
  Alhough they can be freely specified, these are some of the most commonly used claims:
71
+ "valid-from": <string> # token's start (<YYYY-MM-DD hh:mm:ss>)
72
+ "valid-until": <string> # token's finish (<YYYY-MM-DD hh:mm:ss>)
69
73
  "birthdate": <string> # subject's birth date
70
74
  "email": <string> # subject's email
71
75
  "gender": <string> # subject's gender
@@ -147,10 +151,12 @@ class JwtData:
147
151
  :param logger: optional logger
148
152
  return: *True* if the access data was removed, *False* otherwise
149
153
  """
154
+ # remove from internal storage
150
155
  account_data: dict[str, Any] | None
151
156
  with self.access_lock:
152
157
  account_data = self.access_data.pop(account_id, None)
153
158
 
159
+ # remove from database
154
160
  db_delete(errors=None,
155
161
  delete_stmt=f"DELETE FROM {JWT_DB_TABLE}",
156
162
  where_data={JWT_DB_COL_ACCOUNT: account_id},
@@ -238,6 +244,10 @@ class JwtData:
238
244
 
239
245
  # issue a candidate refresh token first, and persist it
240
246
  current_claims["exp"] = just_now + account_data.get("refresh-max-age")
247
+ current_claims["valid-from"] = datetime.fromtimestamp(timestamp=current_claims["iat"],
248
+ tz=timezone.utc).isoformat()
249
+ current_claims["valid-until"] = datetime.fromtimestamp(timestamp=current_claims["exp"],
250
+ tz=timezone.utc).isoformat()
241
251
  # may raise an exception
242
252
  refresh_token: str = jwt.encode(payload=current_claims,
243
253
  key=JWT_ENCODING_KEY,
@@ -379,9 +379,11 @@ def jwt_get_claims(errors: list[str] | None,
379
379
  "header": {
380
380
  "alg": "RS256",
381
381
  "typ": "JWT",
382
- "kid": "rt466ytRTYH64577uydhDFGHDYJH2341"
382
+ "kid": "1234"
383
383
  },
384
384
  "payload": {
385
+ "valid-from": <YYYY-MM-DD hh:mm:ss>
386
+ "valid-until": <YYYY-MM-DD hh:mm:ss>
385
387
  "birthdate": "1980-01-01",
386
388
  "email": "jdoe@mail.com",
387
389
  "exp": 1516640454,
File without changes
File without changes
File without changes
File without changes