Skip to content

Commit

Permalink
changed middleware.py to optimize usage of variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuhin-thinks committed Oct 2, 2024
1 parent ac5aacd commit d7ff603
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions oauth2_provider/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ def __init__(self, get_response):

def __call__(self, request):
authheader = request.META.get("HTTP_AUTHORIZATION", "")
if authheader.startswith("Bearer") and len(authheader.split(maxsplit=1)) == 2:
tokenstring = authheader.split(maxsplit=1)[1]
splits = authheader.split(maxsplit=1)
if authheader.startswith("Bearer") and len(splits) == 2:
tokenstring = splits[1]
AccessToken = get_access_token_model()
try:
token_checksum = hashlib.sha256(tokenstring.encode("utf-8")).hexdigest()
Expand Down

0 comments on commit d7ff603

Please sign in to comment.