Skip to content

Commit 56c721d

Browse files
committed
Simpler header matching
1 parent 0d56349 commit 56c721d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rest_framework_sso/authentication.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import jwt
55
from django.contrib.auth import get_user_model
6+
from django.utils.encoding import smart_text
67
from django.utils.translation import ugettext as _
78
from rest_framework import exceptions
89
from rest_framework.authentication import (
@@ -26,8 +27,9 @@ class JWTAuthentication(BaseAuthentication):
2627

2728
def authenticate(self, request):
2829
auth = get_authorization_header(request).split()
30+
authenticate_header = self.authenticate_header(request=request)
2931

30-
if not auth or auth[0].lower() != api_settings.AUTHENTICATE_HEADER.lower().encode('utf-8'):
32+
if not auth or smart_text(auth[0].lower()) != authenticate_header.lower():
3133
return None
3234

3335
if len(auth) == 1:

0 commit comments

Comments
 (0)