Skip to content

Commit 1f8a7c1

Browse files
committed
More resilient to errors.
1 parent 3843f7d commit 1f8a7c1

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

example/flask_rp/application.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def init_oidc_rp_handler(app):
1616
if _rp_conf.key_conf:
1717
_kj = init_key_jar(**_rp_conf.key_conf)
1818
_path = _rp_conf.key_conf['public_path']
19-
# removes ./ and / from the begin of the string
19+
# removes ./ and / from the begining of the string
2020
_path = re.sub('^(.)/', '', _path)
2121
else:
2222
_kj = KeyJar()

src/idpyoidc/client/client_auth.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,8 @@ def single_authn_setup(name, spec):
675675
else:
676676
if spec is None:
677677
cls = get_client_authn_class(name)
678+
if cls is None:
679+
cls = importer(name)
678680
elif isinstance(spec, str):
679681
cls = importer(spec)
680682
else:

src/idpyoidc/client/oauth2/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,12 @@ def pick_redirect_uri(
7676
if redirect_uris:
7777
redirect_uri = redirect_uris[0]
7878
else:
79-
logger.error("No redirect_uri")
80-
raise MissingRequiredAttribute("redirect_uri")
79+
redirect_uris = context.get_preference("redirect_uris", [])
80+
if redirect_uris:
81+
redirect_uri = redirect_uris[0]
82+
else:
83+
logger.error("No redirect_uri")
84+
raise MissingRequiredAttribute("redirect_uri")
8185

8286
return redirect_uri
8387

src/idpyoidc/server/endpoint.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,13 @@ def parse_request(
229229
# Verify that the client is allowed to do this
230230
auth_info = self.client_authentication(req, http_info, endpoint=self, **kwargs)
231231

232-
if "client_id" in auth_info:
233-
req["client_id"] = auth_info["client_id"]
232+
_client_id = auth_info.get("client_id", "")
233+
if _client_id:
234+
req["client_id"] = _client_id
234235

235236
_auth_method = auth_info.get("method")
236237
if _auth_method and _auth_method not in ["public", "none"]:
237238
req["authenticated"] = True
238-
239-
_client_id = auth_info["client_id"]
240239
else:
241240
_client_id = req.get("client_id")
242241

0 commit comments

Comments
 (0)