mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 15:12:08 +01:00
fix(backend): adressed copilot review
This commit is contained in:
@@ -56,15 +56,14 @@ async def auth_guard(request: Request, call_next):
|
||||
# Enforce revoked/expired JWTs are rejected globally
|
||||
token = extract_bearer_token(request)
|
||||
if token:
|
||||
from fastapi import Response, status as _status
|
||||
# Deny if token is revoked
|
||||
if is_token_revoked(token):
|
||||
from fastapi import Response, status as _status
|
||||
return Response(status_code=_status.HTTP_401_UNAUTHORIZED)
|
||||
# Deny if token is expired or invalid
|
||||
try:
|
||||
decode_and_verify_jwt(token, SECRET)
|
||||
except Exception:
|
||||
from fastapi import Response, status as _status
|
||||
return Response(status_code=_status.HTTP_401_UNAUTHORIZED)
|
||||
return await call_next(request)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user