Skip to content
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

WIP: Don't assume it's a Bearer token in Authorization header #965

Closed
wants to merge 1 commit into from
Closed
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: 6 additions & 2 deletions oauth2_provider/oauth2_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,12 @@ def verify_request(self, request, scopes):
:param scopes: A list of scopes required to verify so that request is verified
"""
uri, http_method, body, headers = self._extract_params(request)

valid, r = self.server.verify_request(uri, http_method, body, headers, scopes=scopes)
# Oauthlib has an assumption (without confirming) that the only kind of Authorization header is a Bearer.
# It's entirely possible to have multiple authentication classes that include Basic as well. See #964.
if "Authorization" in headers and headers["Authorization"].startswith("Bearer "):
valid, r = self.server.verify_request(uri, http_method, body, headers, scopes=scopes)
else:
valid, r = False, None
return valid, r

def authenticate_client(self, request):
Expand Down