From 58a1b391da2d977d145bb24cbd1054428e203ca5 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Belanger Date: Fri, 17 Jul 2020 11:11:35 -0400 Subject: [PATCH] remove extra quote_plus --- src/oic/utils/authn/client.py | 1 - src/oic/utils/authn/user.py | 3 --- tests/test_authn_user.py | 3 +-- tests/test_client.py | 3 +-- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/oic/utils/authn/client.py b/src/oic/utils/authn/client.py index 6018a782f..560c6e3c0 100644 --- a/src/oic/utils/authn/client.py +++ b/src/oic/utils/authn/client.py @@ -1,6 +1,5 @@ import base64 import logging -from urllib.parse import quote_plus from jwkest import Invalid from jwkest import MissingKey diff --git a/src/oic/utils/authn/user.py b/src/oic/utils/authn/user.py index 91cc206ba..1db76eee8 100644 --- a/src/oic/utils/authn/user.py +++ b/src/oic/utils/authn/user.py @@ -3,7 +3,6 @@ import logging import time from urllib.parse import parse_qs -from urllib.parse import unquote_plus from urllib.parse import urlencode from urllib.parse import urlsplit from urllib.parse import urlunsplit @@ -394,8 +393,6 @@ def authenticated_as(self, cookie=None, authorization="", **kwargs): _decoded = as_unicode(base64.b64decode(authorization)) (user, pwd) = _decoded.split(":") - user = unquote_plus(user) - pwd = unquote_plus(pwd) self.verify_password(user, pwd) return {"uid": user}, time.time() diff --git a/tests/test_authn_user.py b/tests/test_authn_user.py index bb9459410..a65973fe6 100644 --- a/tests/test_authn_user.py +++ b/tests/test_authn_user.py @@ -1,5 +1,4 @@ import base64 -from urllib.parse import quote_plus import pytest @@ -21,7 +20,7 @@ def test_basic_authn_authenticate_as(): ba = BasicAuthn(None, pwd=pwd_database) for user, passwd in pwd_database.items(): - credentials = "{}:{}".format(quote_plus(user), quote_plus(passwd)) + credentials = "{}:{}".format(user, passwd) authz = base64.b64encode(credentials.encode("utf-8")).decode("utf-8") authorization_string = "Basic {}".format(authz) diff --git a/tests/test_client.py b/tests/test_client.py index 295d7b0b6..d411e6b7c 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -2,7 +2,6 @@ import os from unittest.mock import Mock from unittest.mock import patch -from urllib.parse import quote_plus import pytest from jwkest import as_bytes @@ -63,7 +62,7 @@ def test_construct(self, client): csb = ClientSecretBasic(client) http_args = csb.construct(cis) - cred = "{}:{}".format(quote_plus("A"), quote_plus("boarding pass")) + cred = "{}:{}".format("A", "boarding pass") assert http_args == { "headers": { "Authorization": "Basic {}".format(