pypomes-iam 0.0.4__tar.gz → 0.0.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-iam might be problematic. Click here for more details.
- {pypomes_iam-0.0.4 → pypomes_iam-0.0.6}/PKG-INFO +1 -1
- {pypomes_iam-0.0.4 → pypomes_iam-0.0.6}/pyproject.toml +1 -1
- {pypomes_iam-0.0.4 → pypomes_iam-0.0.6}/src/pypomes_iam/__init__.py +1 -1
- {pypomes_iam-0.0.4 → pypomes_iam-0.0.6}/src/pypomes_iam/iam_jusbr.py +19 -13
- {pypomes_iam-0.0.4 → pypomes_iam-0.0.6}/.gitignore +0 -0
- {pypomes_iam-0.0.4 → pypomes_iam-0.0.6}/LICENSE +0 -0
- {pypomes_iam-0.0.4 → pypomes_iam-0.0.6}/README.md +0 -0
- {pypomes_iam-0.0.4 → pypomes_iam-0.0.6}/src/pypomes_iam/iam_provider.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pypomes_iam
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: A collection of Python pomes, penyeach (IAM modules)
|
|
5
5
|
Project-URL: Homepage, https://github.com/TheWiseCoder/PyPomes-IAM
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/TheWiseCoder/PyPomes-IAM/issues
|
|
@@ -218,6 +218,7 @@ def service_callback() -> Response:
|
|
|
218
218
|
break
|
|
219
219
|
|
|
220
220
|
# exchange 'code' for the token
|
|
221
|
+
token: str | None = None
|
|
221
222
|
errors: list[str] = []
|
|
222
223
|
if user_data:
|
|
223
224
|
code: str = request.args.get("code")
|
|
@@ -226,10 +227,10 @@ def service_callback() -> Response:
|
|
|
226
227
|
"code": code,
|
|
227
228
|
"redirec_url": _jusbr_registry.get("redirect-url"),
|
|
228
229
|
}
|
|
229
|
-
__post_jusbr(user_data=user_data,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
230
|
+
token = __post_jusbr(user_data=user_data,
|
|
231
|
+
body_data=body_data,
|
|
232
|
+
errors=errors,
|
|
233
|
+
logger=_logger)
|
|
233
234
|
else:
|
|
234
235
|
msg: str = "Unknown OAuth2 code received"
|
|
235
236
|
if __get_login_timeout():
|
|
@@ -241,7 +242,7 @@ def service_callback() -> Response:
|
|
|
241
242
|
result = jsonify({"errors": "; ".join(errors)})
|
|
242
243
|
result.status_code = 400
|
|
243
244
|
else:
|
|
244
|
-
result =
|
|
245
|
+
result = jsonify({"access_token": token})
|
|
245
246
|
|
|
246
247
|
return result
|
|
247
248
|
|
|
@@ -279,6 +280,7 @@ def jusbr_get_token(user_id: str,
|
|
|
279
280
|
:param user_id: the user's identification
|
|
280
281
|
:param errors: incidental error messages
|
|
281
282
|
:param logger: optional logger
|
|
283
|
+
:return: the token for *user_id*, or *None* if error
|
|
282
284
|
"""
|
|
283
285
|
global _jusbr_registry
|
|
284
286
|
|
|
@@ -301,12 +303,10 @@ def jusbr_get_token(user_id: str,
|
|
|
301
303
|
"grant_type": "refresh_token",
|
|
302
304
|
"refresh_token": refresh_token
|
|
303
305
|
}
|
|
304
|
-
__post_jusbr(user_data=user_data,
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
if not errors:
|
|
309
|
-
result = safe_cache.get("access_token")
|
|
306
|
+
result = __post_jusbr(user_data=user_data,
|
|
307
|
+
body_data=body_data,
|
|
308
|
+
errors=errors,
|
|
309
|
+
logger=logger)
|
|
310
310
|
|
|
311
311
|
elif logger or isinstance(errors, list):
|
|
312
312
|
err_msg: str = f"User '{user_id}' not authenticated with JusBR"
|
|
@@ -377,9 +377,9 @@ def __get_user_data(user_id: str,
|
|
|
377
377
|
def __post_jusbr(user_data: dict[str, Any],
|
|
378
378
|
body_data: dict[str, Any],
|
|
379
379
|
errors: list[str] | None,
|
|
380
|
-
logger: Logger | None) -> None:
|
|
380
|
+
logger: Logger | None) -> str | None:
|
|
381
381
|
"""
|
|
382
|
-
Send a POST request to JusBR to obtain the authentication
|
|
382
|
+
Send a POST request to JusBR to obtain the authentication token data, and return the access token.
|
|
383
383
|
|
|
384
384
|
For code for token exchange, *body_data* will have the attributes
|
|
385
385
|
- "grant_type": "authorization_code"
|
|
@@ -396,9 +396,13 @@ def __post_jusbr(user_data: dict[str, Any],
|
|
|
396
396
|
:param body_data: the data to send in the body of the request
|
|
397
397
|
:param errors: incidental errors
|
|
398
398
|
:param logger: optional logger
|
|
399
|
+
:return: the access token obtained, or *None* if error
|
|
399
400
|
"""
|
|
400
401
|
global _jusbr_registry
|
|
401
402
|
|
|
403
|
+
# initialize the return variable
|
|
404
|
+
result: str | None = None
|
|
405
|
+
|
|
402
406
|
# complete the data to send in body of request
|
|
403
407
|
body_data["client_id"] = _jusbr_registry.get("client-id")
|
|
404
408
|
client_secret: str = _jusbr_registry.get("client-secret")
|
|
@@ -449,3 +453,5 @@ def __post_jusbr(user_data: dict[str, Any],
|
|
|
449
453
|
errors.append(err_msg)
|
|
450
454
|
if logger:
|
|
451
455
|
logger.error(msg=err_msg)
|
|
456
|
+
|
|
457
|
+
return result
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|