Skip to content

Commit ed808c4

Browse files
Improved graphql middleware
1 parent 4dff616 commit ed808c4

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

nxtbn/users/auth_middleware.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,17 @@ def resolve(self, next, root, info, **args):
2626
return next(root, info, **args)
2727

2828
def get_user_from_jwt(self, request):
29-
"""Retrieve the user from the JWT token in the request."""
3029
token = self.get_token_from_request(request)
3130
if token:
3231
return self.jwt_manager.verify_jwt_token(token) or AnonymousUser()
3332
return AnonymousUser()
3433

3534
def get_user_from_session(self, request):
36-
"""Retrieve the user from the session, if available."""
3735
return request.user if request.user.is_authenticated else AnonymousUser()
3836

3937
def get_token_from_request(self, request):
40-
"""Extract the token from the Authorization header or cookies."""
41-
# Check Authorization header
4238
auth_header = request.headers.get("Authorization")
4339
if auth_header and auth_header.startswith("Bearer "):
4440
return auth_header.split(" ")[1]
4541

46-
# Fallback to cookies
4742
return request.COOKIES.get("access_token")

0 commit comments

Comments
 (0)