Commit c449dd4f by Pierre Dulac

Properly fail to wrong Authorization token type

parent 8809c46a
......@@ -176,7 +176,7 @@ class OAuth2Authentication(BaseAuthentication):
"""
auth = request.META.get('HTTP_AUTHORIZATION', '').split()
if not auth or auth[0].lower() != "bearer":
return None
raise exceptions.AuthenticationFailed('Invalid Authorization token type')
if len(auth) != 2:
raise exceptions.AuthenticationFailed('Invalid token header')
......@@ -212,8 +212,6 @@ class OAuth2Authentication(BaseAuthentication):
raise exceptions.AuthenticationFailed(
'You are not allowed to access this resource.')
return None
def authenticate_header(self, request):
"""
Bearer is the only finalized type currently
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment