pypomes-jwt 1.3.4__py3-none-any.whl → 1.3.6__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_config.py +1 -0
- pypomes_jwt/jwt_providers.py +4 -5
- pypomes_jwt/jwt_registry.py +9 -9
- {pypomes_jwt-1.3.4.dist-info → pypomes_jwt-1.3.6.dist-info}/METADATA +4 -4
- pypomes_jwt-1.3.6.dist-info/RECORD +9 -0
- pypomes_jwt-1.3.4.dist-info/RECORD +0 -9
- {pypomes_jwt-1.3.4.dist-info → pypomes_jwt-1.3.6.dist-info}/WHEEL +0 -0
- {pypomes_jwt-1.3.4.dist-info → pypomes_jwt-1.3.6.dist-info}/licenses/LICENSE +0 -0
pypomes_jwt/jwt_config.py
CHANGED
|
@@ -43,6 +43,7 @@ elif not _encoding_key or not _decoding_key:
|
|
|
43
43
|
format=serialization.PublicFormat.SubjectPublicKeyInfo)
|
|
44
44
|
|
|
45
45
|
|
|
46
|
+
# HAZARD: instances uses must be '.value' qualified, as this is not a subclass of either 'StrEnum' or 'IntEnum'
|
|
46
47
|
class JwtConfig(Enum):
|
|
47
48
|
"""
|
|
48
49
|
Parameters for JWT token issuance.
|
pypomes_jwt/jwt_providers.py
CHANGED
|
@@ -63,7 +63,7 @@ def provider_register(provider_id: str,
|
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
def provider_get_token(provider_id: str,
|
|
66
|
-
errors: list[str]
|
|
66
|
+
errors: list[str] = None,
|
|
67
67
|
logger: Logger = None) -> str | None:
|
|
68
68
|
"""
|
|
69
69
|
Obtain an authentication token from the external provider *provider_id*.
|
|
@@ -96,12 +96,12 @@ def provider_get_token(provider_id: str,
|
|
|
96
96
|
try:
|
|
97
97
|
# typical return on a token request:
|
|
98
98
|
# {
|
|
99
|
-
# "token_type": "
|
|
99
|
+
# "token_type": "Bearer",
|
|
100
100
|
# "access_token": <str>,
|
|
101
101
|
# "expires_in": <number-of-seconds>,
|
|
102
102
|
# optional data:
|
|
103
103
|
# "refresh_token": <str>,
|
|
104
|
-
# "refresh_expires_in": <
|
|
104
|
+
# "refresh_expires_in": <number-of-seconds>
|
|
105
105
|
# }
|
|
106
106
|
response: Response = requests.post(url=url,
|
|
107
107
|
data=body_data,
|
|
@@ -116,8 +116,7 @@ def provider_get_token(provider_id: str,
|
|
|
116
116
|
provider["token"] = reply.get("access_token")
|
|
117
117
|
provider["expiration"] = now + int(reply.get("expires_in"))
|
|
118
118
|
if logger:
|
|
119
|
-
logger.debug(msg=f"POST '{url}': status "
|
|
120
|
-
f"{response.status_code}, reason '{response.reason}')")
|
|
119
|
+
logger.debug(msg=f"POST '{url}': status {response.status_code}")
|
|
121
120
|
except Exception as e:
|
|
122
121
|
# the operation raised an exception
|
|
123
122
|
err_msg = exc_format(exc=e,
|
pypomes_jwt/jwt_registry.py
CHANGED
|
@@ -203,8 +203,8 @@ class JwtRegistry:
|
|
|
203
203
|
|
|
204
204
|
# may raise an exception
|
|
205
205
|
return jwt.encode(payload=current_claims,
|
|
206
|
-
key=JwtConfig.ENCODING_KEY,
|
|
207
|
-
algorithm=JwtConfig.DEFAULT_ALGORITHM,
|
|
206
|
+
key=JwtConfig.ENCODING_KEY.value,
|
|
207
|
+
algorithm=JwtConfig.DEFAULT_ALGORITHM.value,
|
|
208
208
|
headers={"kid": nature})
|
|
209
209
|
|
|
210
210
|
def issue_tokens(self,
|
|
@@ -258,8 +258,8 @@ class JwtRegistry:
|
|
|
258
258
|
current_claims["exp"] = just_now + account_data.get("refresh-max-age")
|
|
259
259
|
# may raise an exception
|
|
260
260
|
refresh_token: str = jwt.encode(payload=current_claims,
|
|
261
|
-
key=JwtConfig.ENCODING_KEY,
|
|
262
|
-
algorithm=JwtConfig.DEFAULT_ALGORITHM,
|
|
261
|
+
key=JwtConfig.ENCODING_KEY.value,
|
|
262
|
+
algorithm=JwtConfig.DEFAULT_ALGORITHM.value,
|
|
263
263
|
headers={"kid": "R0"})
|
|
264
264
|
|
|
265
265
|
# make sure to have a database connection
|
|
@@ -275,8 +275,8 @@ class JwtRegistry:
|
|
|
275
275
|
logger=logger)
|
|
276
276
|
# issue the definitive refresh token
|
|
277
277
|
refresh_token = jwt.encode(payload=current_claims,
|
|
278
|
-
key=JwtConfig.ENCODING_KEY,
|
|
279
|
-
algorithm=JwtConfig.DEFAULT_ALGORITHM,
|
|
278
|
+
key=JwtConfig.ENCODING_KEY.value,
|
|
279
|
+
algorithm=JwtConfig.DEFAULT_ALGORITHM.value,
|
|
280
280
|
headers={"kid": f"R{token_id}"})
|
|
281
281
|
# persist it
|
|
282
282
|
db_update(update_stmt=f"UPDATE {JwtDbConfig.TABLE}",
|
|
@@ -305,8 +305,8 @@ class JwtRegistry:
|
|
|
305
305
|
current_claims["exp"] = just_now + account_data.get("access-max-age")
|
|
306
306
|
# may raise an exception
|
|
307
307
|
access_token: str = jwt.encode(payload=current_claims,
|
|
308
|
-
key=JwtConfig.ENCODING_KEY,
|
|
309
|
-
algorithm=JwtConfig.DEFAULT_ALGORITHM,
|
|
308
|
+
key=JwtConfig.ENCODING_KEY.value,
|
|
309
|
+
algorithm=JwtConfig.DEFAULT_ALGORITHM.value,
|
|
310
310
|
headers={"kid": f"A{token_id}"})
|
|
311
311
|
# return the token data
|
|
312
312
|
return {
|
|
@@ -438,7 +438,7 @@ class JwtRegistry:
|
|
|
438
438
|
JwtDbConfig.COL_ACCOUNT: account_id,
|
|
439
439
|
JwtDbConfig.COL_TOKEN: jwt_token,
|
|
440
440
|
JwtDbConfig.COL_ALGORITHM:
|
|
441
|
-
JwtConfig.DEFAULT_ALGORITHM,
|
|
441
|
+
JwtConfig.DEFAULT_ALGORITHM.value,
|
|
442
442
|
JwtDbConfig.COL_DECODER:
|
|
443
443
|
b64encode(s=JwtConfig.DECODING_KEY.value).decode()
|
|
444
444
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pypomes_jwt
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.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
|
|
@@ -10,8 +10,8 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Requires-Python: >=3.12
|
|
13
|
-
Requires-Dist: cryptography>=
|
|
13
|
+
Requires-Dist: cryptography>=46.0.2
|
|
14
14
|
Requires-Dist: flask>=3.1.2
|
|
15
15
|
Requires-Dist: pyjwt>=2.10.1
|
|
16
|
-
Requires-Dist: pypomes-core>=2.7.
|
|
17
|
-
Requires-Dist: pypomes-db>=2.7.
|
|
16
|
+
Requires-Dist: pypomes-core>=2.7.6
|
|
17
|
+
Requires-Dist: pypomes-db>=2.7.6
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
pypomes_jwt/__init__.py,sha256=vXAeaEnuUqpvGtV465TsW2Lf3ihijrMP2Hm4My79y88,968
|
|
2
|
+
pypomes_jwt/jwt_config.py,sha256=GAFrvsCeBUIt2OzO-xLSM6qTe7iehvqrcHlu_CUnGAI,3638
|
|
3
|
+
pypomes_jwt/jwt_pomes.py,sha256=WWmZYVpG6wqlIjcJU3jNyBquCgfB-OcgCJBmm6imL4Q,23524
|
|
4
|
+
pypomes_jwt/jwt_providers.py,sha256=3o48fGZ9W0xwpdivECMb2E3GLdraU-Vh8zRyejbLgpc,5853
|
|
5
|
+
pypomes_jwt/jwt_registry.py,sha256=ypBEoL0I2F08sR2G2VO9wXxVeE252lNzjIAC3FGORhA,22631
|
|
6
|
+
pypomes_jwt-1.3.6.dist-info/METADATA,sha256=bWvYWUMYqc6AecDMkK0p3KxvXRMLZUTEglopfd8pk_A,660
|
|
7
|
+
pypomes_jwt-1.3.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8
|
+
pypomes_jwt-1.3.6.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
|
|
9
|
+
pypomes_jwt-1.3.6.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
pypomes_jwt/__init__.py,sha256=vXAeaEnuUqpvGtV465TsW2Lf3ihijrMP2Hm4My79y88,968
|
|
2
|
-
pypomes_jwt/jwt_config.py,sha256=74MFwU5gDx9c1_OHFcFMY-AyD-yqnBQGY6Y2JkkslwQ,3525
|
|
3
|
-
pypomes_jwt/jwt_pomes.py,sha256=WWmZYVpG6wqlIjcJU3jNyBquCgfB-OcgCJBmm6imL4Q,23524
|
|
4
|
-
pypomes_jwt/jwt_providers.py,sha256=LL2OxdyGH3_O-qEOVjg_GsPQVRtaSi37AE-BOZ6tiqs,5928
|
|
5
|
-
pypomes_jwt/jwt_registry.py,sha256=TuIbnAUlYyFcP8DD7dyViNn49N6NoaEp8bBfDkW29_k,22577
|
|
6
|
-
pypomes_jwt-1.3.4.dist-info/METADATA,sha256=h3KzUz2C1AveXub-T-GwWyAOaxvkjat-P4VMMLx5vu4,660
|
|
7
|
-
pypomes_jwt-1.3.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8
|
-
pypomes_jwt-1.3.4.dist-info/licenses/LICENSE,sha256=NdakochSXm_H_-DSL_x2JlRCkYikj3snYYvTwgR5d_c,1086
|
|
9
|
-
pypomes_jwt-1.3.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|