Skip to content

Commit e2ae4f3

Browse files
committed
Security HTTP provider fix
1 parent 89ec335 commit e2ae4f3

File tree

4 files changed

+4
-17
lines changed

4 files changed

+4
-17
lines changed

openapi_core/security/providers.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import binascii
21
import warnings
32

43
from openapi_core.security.exceptions import SecurityError
5-
from openapi_core.security.util import b64decode
64

75

86
class BaseProvider(object):
@@ -40,7 +38,5 @@ def __call__(self, request):
4038
if auth_type.lower() != self.scheme.scheme.value:
4139
raise SecurityError(
4240
'Unknown authorization method %s' % auth_type)
43-
try:
44-
return b64decode(encoded_credentials).decode('latin1')
45-
except binascii.Error:
46-
raise SecurityError('Invalid base64 encoding.')
41+
42+
return encoded_credentials

openapi_core/security/util.py

-9
This file was deleted.

tests/integration/validation/test_validators.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def test_get_pet(self, validator):
283283
},
284284
)
285285
assert result.security == {
286-
'petstore_auth': self.api_key,
286+
'petstore_auth': self.api_key_encoded,
287287
}
288288

289289

tests/unit/security/test_providers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ def test_issue29427(self, provider):
3030

3131
result = provider(request)
3232

33-
assert result == '1'
33+
assert result == jwt

0 commit comments

Comments
 (0)