Skip to content
This repository was archived by the owner on Jun 12, 2021. It is now read-only.

Commit 9deef18

Browse files
committed
Allow 'none' as a client auth method.
1 parent ebd85d9 commit 9deef18

3 files changed

Lines changed: 557 additions & 6 deletions

File tree

src/oidcendpoint/client_authn.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ def verify_client(
310310
pass
311311

312312
for _method in _methods:
313+
if _method is None:
314+
continue
313315
if _method.is_usable(request, authorization_info):
314316
try:
315317
auth_info = _method.verify(request=request, authorization_info=authorization_info,
@@ -322,7 +324,10 @@ def verify_client(
322324
break
323325

324326
if not auth_info:
325-
return auth_info
327+
if None in _methods:
328+
auth_info = {"method": "none", "client_id": request.get("client_id")}
329+
else:
330+
return auth_info
326331

327332
if also_known_as:
328333
client_id = also_known_as[auth_info.get("client_id")]
@@ -375,10 +380,13 @@ def client_auth_setup(auth_set, endpoint_context):
375380
res = []
376381

377382
for item in auth_set:
378-
_cls = CLIENT_AUTHN_METHOD.get(item)
379-
if _cls:
380-
res.append(_cls(endpoint_context))
383+
if item is None or item.lower() == 'none':
384+
res.append(None)
381385
else:
382-
res.append(importer(item)(endpoint_context))
386+
_cls = CLIENT_AUTHN_METHOD.get(item)
387+
if _cls:
388+
res.append(_cls(endpoint_context))
389+
else:
390+
res.append(importer(item)(endpoint_context))
383391

384392
return res

src/oidcendpoint/endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def __init__(self, endpoint_context, **kwargs):
182182
if _methods:
183183
self.client_authn_method = client_auth_setup(_methods, endpoint_context)
184184
elif _methods is not None: # [] or '' or something not None but regarded as nothing.
185-
pass # Ignore default value
185+
self.client_authn_method = [None] # Ignore default value
186186
elif self.default_capabilities:
187187
_methods = self.default_capabilities.get("client_authn_method")
188188
if _methods:

0 commit comments

Comments
 (0)