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

Commit d951304

Browse files
committed
User name and password are quoted before the token in constructed. This about client client_secret_basic authentication.
1 parent 64bdc07 commit d951304

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/oidcendpoint/client_authn.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import base64
22
import logging
3+
from urllib.parse import unquote_plus
34

45
from cryptojwt.exception import BadSignature
56
from cryptojwt.exception import Invalid
@@ -62,7 +63,7 @@ def basic_authn(authn):
6263
_tok = as_bytes(authn[6:])
6364
# Will raise ValueError type exception if not base64 encoded
6465
_tok = base64.b64decode(_tok)
65-
part = as_unicode(_tok).split(":")
66+
part = [unquote_plus(p) for p in as_unicode(_tok).split(":")]
6667
if len(part) == 2:
6768
return dict(zip(["id", "secret"], part))
6869
else:
@@ -280,19 +281,14 @@ def verify_client(
280281

281282
# store what authn method was used
282283
if auth_info.get("method"):
283-
if (
284-
endpoint_context.cdb[client_id].get("auth_method")
285-
and request.__class__.__name__
286-
in endpoint_context.cdb[client_id]["auth_method"]
287-
):
288-
endpoint_context.cdb[client_id]["auth_method"][
289-
request.__class__.__name__
290-
] = auth_info["method"]
284+
_request_type = request.__class__.__name__
285+
_used_authn_method = endpoint_context.cdb[client_id].get("auth_method")
286+
if _used_authn_method:
287+
endpoint_context.cdb[client_id]["auth_method"][_request_type] = auth_info["method"]
291288
else:
292289
endpoint_context.cdb[client_id]["auth_method"] = {
293-
request.__class__.__name__: auth_info["method"]
290+
_request_type: auth_info["method"]
294291
}
295-
296292
elif not client_id and get_client_id_from_token:
297293
if not _token:
298294
logger.warning("No token")

0 commit comments

Comments
 (0)