pypomes-jwt 0.6.7__py3-none-any.whl → 0.6.9__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.
- pypomes_jwt/jwt_data.py +13 -7
- {pypomes_jwt-0.6.7.dist-info → pypomes_jwt-0.6.9.dist-info}/METADATA +1 -1
- pypomes_jwt-0.6.9.dist-info/RECORD +7 -0
- pypomes_jwt-0.6.7.dist-info/RECORD +0 -7
- {pypomes_jwt-0.6.7.dist-info → pypomes_jwt-0.6.9.dist-info}/WHEEL +0 -0
- {pypomes_jwt-0.6.7.dist-info → pypomes_jwt-0.6.9.dist-info}/licenses/LICENSE +0 -0
pypomes_jwt/jwt_data.py
CHANGED
|
@@ -209,11 +209,12 @@ class JwtData:
|
|
|
209
209
|
custom_claims: dict[str, Any] = access_data.get("custom-claims")
|
|
210
210
|
if superceding_claims:
|
|
211
211
|
custom_claims = custom_claims.copy()
|
|
212
|
-
custom_claims.update(
|
|
212
|
+
custom_claims.update(superceding_claims)
|
|
213
213
|
|
|
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
|
-
claims.update(
|
|
245
|
-
claims.update(
|
|
247
|
+
claims.update(reserved_claims)
|
|
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
|
|
@@ -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
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
pypomes_jwt/__init__.py,sha256=CwpFtZEi1Yo1i4ulyR65yvo_fJpSRMJsXwzV75E3K0A,988
|
|
2
|
+
pypomes_jwt/jwt_data.py,sha256=o89rMzaUp3-GpX3zei2UkFzYacyjmMvi2QPq1vBaNGY,19945
|
|
3
|
+
pypomes_jwt/jwt_pomes.py,sha256=rhYoqD57yXayJoePdjbB3RfPAIg23o6YQKkdnD4tz0c,14222
|
|
4
|
+
pypomes_jwt-0.6.9.dist-info/METADATA,sha256=penqUj2BH3vbm9Br2kOv15Gcj5fkBj6Jx6tug_bbYxY,599
|
|
5
|
+
pypomes_jwt-0.6.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
6
|
+
pypomes_jwt-0.6.9.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
|
|
7
|
+
pypomes_jwt-0.6.9.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
pypomes_jwt/__init__.py,sha256=CwpFtZEi1Yo1i4ulyR65yvo_fJpSRMJsXwzV75E3K0A,988
|
|
2
|
-
pypomes_jwt/jwt_data.py,sha256=icnNzfCBPN94z3saT_fhDSEpj_GGBeSW59ychNfkxA8,19680
|
|
3
|
-
pypomes_jwt/jwt_pomes.py,sha256=rhYoqD57yXayJoePdjbB3RfPAIg23o6YQKkdnD4tz0c,14222
|
|
4
|
-
pypomes_jwt-0.6.7.dist-info/METADATA,sha256=8j6R2ZgQXHbw7Wyziiv7BfGAQdlld2bGHcDL14ijpn4,599
|
|
5
|
-
pypomes_jwt-0.6.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
6
|
-
pypomes_jwt-0.6.7.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
|
|
7
|
-
pypomes_jwt-0.6.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|