Skip to content

Security HTTP provider fix #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions openapi_core/security/providers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import binascii
import warnings

from openapi_core.security.exceptions import SecurityError
from openapi_core.security.util import b64decode


class BaseProvider(object):
Expand Down Expand Up @@ -40,7 +38,5 @@ def __call__(self, request):
if auth_type.lower() != self.scheme.scheme.value:
raise SecurityError(
'Unknown authorization method %s' % auth_type)
try:
return b64decode(encoded_credentials).decode('latin1')
except binascii.Error:
raise SecurityError('Invalid base64 encoding.')

return encoded_credentials
9 changes: 0 additions & 9 deletions openapi_core/security/util.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/integration/validation/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def test_get_pet(self, validator):
},
)
assert result.security == {
'petstore_auth': self.api_key,
'petstore_auth': self.api_key_encoded,
}


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/security/test_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ def test_issue29427(self, provider):

result = provider(request)

assert result == '1'
assert result == jwt