pypomes-jwt 0.6.8__tar.gz → 0.6.9__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.
- {pypomes_jwt-0.6.8 → pypomes_jwt-0.6.9}/PKG-INFO +1 -1
- {pypomes_jwt-0.6.8 → pypomes_jwt-0.6.9}/pyproject.toml +1 -1
- {pypomes_jwt-0.6.8 → pypomes_jwt-0.6.9}/src/pypomes_jwt/jwt_data.py +10 -4
- {pypomes_jwt-0.6.8 → pypomes_jwt-0.6.9}/.gitignore +0 -0
- {pypomes_jwt-0.6.8 → pypomes_jwt-0.6.9}/LICENSE +0 -0
- {pypomes_jwt-0.6.8 → pypomes_jwt-0.6.9}/README.md +0 -0
- {pypomes_jwt-0.6.8 → pypomes_jwt-0.6.9}/src/__init__.py +0 -0
- {pypomes_jwt-0.6.8 → pypomes_jwt-0.6.9}/src/pypomes_jwt/__init__.py +0 -0
- {pypomes_jwt-0.6.8 → pypomes_jwt-0.6.9}/src/pypomes_jwt/jwt_pomes.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pypomes_jwt
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.9
|
|
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
|
|
@@ -214,6 +214,7 @@ class JwtData:
|
|
|
214
214
|
# obtain a new token, if the current token has expired
|
|
215
215
|
just_now: int = int(datetime.now(tz=timezone.utc).timestamp())
|
|
216
216
|
if just_now > reserved_claims.get("exp"):
|
|
217
|
+
token_jti: str = str_random(size=16)
|
|
217
218
|
# where is the JWT service provider ?
|
|
218
219
|
if control_data.get("remote-provider"):
|
|
219
220
|
# JWT service is being provided by a remote server
|
|
@@ -233,25 +234,30 @@ class JwtData:
|
|
|
233
234
|
if reply:
|
|
234
235
|
with self.access_lock:
|
|
235
236
|
control_data["access-token"] = reply.get("access_token")
|
|
236
|
-
reserved_claims["jti"] =
|
|
237
|
+
reserved_claims["jti"] = token_jti
|
|
237
238
|
reserved_claims["iat"] = reply.get("created_in")
|
|
238
239
|
reserved_claims["exp"] = reply.get("created_in") + reply.get("expires_in")
|
|
239
240
|
else:
|
|
240
241
|
raise RuntimeError(" - ".join(errors))
|
|
241
242
|
else:
|
|
242
243
|
# JWT service is being provided locally
|
|
244
|
+
token_iat: int = just_now
|
|
245
|
+
token_exp: int = just_now + control_data.get("access-max-age")
|
|
243
246
|
claims: dict[str, Any] = access_data.get("public-claims").copy()
|
|
244
247
|
claims.update(reserved_claims)
|
|
245
248
|
claims.update(custom_claims)
|
|
249
|
+
claims["jti"] = token_jti
|
|
250
|
+
claims["iat"] = token_iat
|
|
251
|
+
claims["exp"] = token_exp
|
|
246
252
|
# may raise an exception
|
|
247
253
|
token: str = jwt.encode(payload=claims,
|
|
248
254
|
key=(control_data.get("hs-secret-key") or
|
|
249
255
|
control_data.get("rsa-private-key")),
|
|
250
256
|
algorithm=control_data.get("algorithm"))
|
|
251
257
|
with self.access_lock:
|
|
252
|
-
reserved_claims["jti"] =
|
|
253
|
-
reserved_claims["iat"] =
|
|
254
|
-
reserved_claims["exp"] =
|
|
258
|
+
reserved_claims["jti"] = token_jti
|
|
259
|
+
reserved_claims["iat"] = token_iat
|
|
260
|
+
reserved_claims["exp"] = token_exp
|
|
255
261
|
control_data["access-token"] = token
|
|
256
262
|
|
|
257
263
|
# return the token
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|