Skip to content

Commit

Permalink
More resilient in handling response_types.
Browse files Browse the repository at this point in the history
Prepare for general automatic registration.
  • Loading branch information
rohe committed May 21, 2024
1 parent ac976ce commit 142fb8b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/idpyoidc/server/client_authn.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,12 @@ def verify_client(
try:
_cinfo = _cdb[client_id]
except KeyError:
raise UnknownClient("Unknown Client ID")
_auto_reg = getattr(endpoint, "automatic_registration", None)
if _auto_reg:
_cinfo = {"client_id": client_id}
_auto_reg.set(client_id, _cinfo)
else:
raise UnknownClient("Unknown Client ID")

if not _cinfo:
raise UnknownClient("Unknown Client ID")
Expand Down
7 changes: 6 additions & 1 deletion src/idpyoidc/server/oauth2/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,12 @@ def create_authn_response(self, request: Union[dict, Message], sid: str) -> dict
list(set(scope + resource_scopes)), _sinfo["client_id"]
)

rtype = set(request["response_type"][:])
if isinstance(request["response_type"], list):
rtype = set(request["response_type"][:])
else: # assume it's a string
rtype = set()
rtype.add(request["response_type"])

handled_response_type = []

fragment_enc = True
Expand Down

0 comments on commit 142fb8b

Please sign in to comment.