Skip to content

Commit 426e3f3

Browse files
committed
- fix: remove authentication jwt header prefix
1 parent eaca85f commit 426e3f3

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

api/authentication/backends.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99

1010
class ActiveSessionAuthentication(authentication.BaseAuthentication):
11-
authentication_header_prefix = "Bearer"
1211

1312
auth_error_message = {
1413
"success": False,
@@ -19,23 +18,12 @@ def authenticate(self, request):
1918

2019
request.user = None
2120

22-
auth_header = authentication.get_authorization_header(request).split()
23-
auth_header_prefix = self.authentication_header_prefix.lower()
21+
auth_header = authentication.get_authorization_header(request)
2422

2523
if not auth_header:
2624
return None
2725

28-
if len(auth_header) == 1:
29-
return None
30-
31-
elif len(auth_header) > 2:
32-
return None
33-
34-
prefix = auth_header[0].decode('utf-8')
35-
token = auth_header[1].decode('utf-8')
36-
37-
if prefix.lower() != auth_header_prefix:
38-
return None
26+
token = auth_header.decode('utf-8')
3927

4028
return self._authenticate_credentials(token)
4129

0 commit comments

Comments
 (0)