Skip to content

Commit

Permalink
remove extra quote_plus
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc-Antoine Belanger committed Jul 17, 2020
1 parent 8bd7390 commit 58a1b39
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/oic/utils/authn/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import base64
import logging
from urllib.parse import quote_plus

from jwkest import Invalid
from jwkest import MissingKey
Expand Down
3 changes: 0 additions & 3 deletions src/oic/utils/authn/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down
3 changes: 1 addition & 2 deletions tests/test_authn_user.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import base64
from urllib.parse import quote_plus

import pytest

Expand All @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 58a1b39

Please sign in to comment.