pypomes-iam 0.4.5__tar.gz → 0.4.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypomes_iam
3
- Version: 0.4.5
3
+ Version: 0.4.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
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "pypomes_iam"
9
- version = "0.4.5"
9
+ version = "0.4.6"
10
10
  authors = [
11
11
  { name="GT Nunes", email="wisecoder01@gmail.com" }
12
12
  ]
@@ -239,7 +239,7 @@ def login_callback(iam_server: IamServer,
239
239
  body_data: dict[str, Any] = {
240
240
  "grant_type": "authorization_code",
241
241
  "code": code,
242
- "redirect_uri": user_data["redirect-uri"]
242
+ "redirect_uri": user_data.pop("redirect-uri")
243
243
  }
244
244
  now: int = int(datetime.now(tz=TZ_LOCAL).timestamp())
245
245
  token_data: dict[str, Any] = __post_for_token(iam_server=iam_server,
@@ -255,7 +255,7 @@ def login_callback(iam_server: IamServer,
255
255
  errors=errors,
256
256
  logger=logger)
257
257
  else:
258
- msg: str = "Unknown state received"
258
+ msg: str = f"State '{oauth_state}' not found in {iam_server}'s registry"
259
259
  if logger:
260
260
  logger.error(msg=msg)
261
261
  if isinstance(errors, list):
@@ -398,14 +398,16 @@ def __post_for_token(iam_server: IamServer,
398
398
  # complete the data to send in body of request
399
399
  body_data["client_id"] = registry["client-id"]
400
400
  client_secret: str = registry["client-secret"]
401
- if client_secret:
402
- body_data["client_secret"] = client_secret
403
401
 
404
402
  # obtain the token
405
403
  url: str = registry["base-url"] + "/protocol/openid-connect/token"
404
+
405
+ # log the POST ('client_secret' data must not be shown in log)
406
406
  if logger:
407
407
  logger.debug(msg=f"POST '{url}', data {json.dumps(obj=body_data,
408
408
  ensure_ascii=False)}")
409
+ if client_secret:
410
+ body_data["client_secret"] = client_secret
409
411
  try:
410
412
  # typical return on a token request:
411
413
  # {
@@ -72,8 +72,7 @@ def jusbr_setup(flask_app: Flask,
72
72
  "base-url": base_url,
73
73
  "pk-expiration": sys.maxsize,
74
74
  "pk-lifetime": public_key_lifetime,
75
- "cache": cache,
76
- "redirect-uri": None
75
+ "cache": cache
77
76
  }
78
77
 
79
78
  # establish the endpoints
@@ -81,8 +81,7 @@ def keycloak_setup(flask_app: Flask,
81
81
  "base-url": f"{base_url}/realms/{realm}",
82
82
  "pk-expiration": sys.maxsize,
83
83
  "pk-lifetime": public_key_lifetime,
84
- "cache": cache,
85
- "redirect-uri": None
84
+ "cache": cache
86
85
  }
87
86
 
88
87
  # establish the endpoints
File without changes
File without changes
File without changes