финальные evidence для lab2 + кэширование
This commit is contained in:
+4
-1
@@ -2,6 +2,7 @@ import hashlib
|
||||
import os
|
||||
import secrets
|
||||
from datetime import datetime, timezone
|
||||
from uuid import UUID
|
||||
|
||||
import bcrypt
|
||||
from fastapi import Depends, Header, HTTPException
|
||||
@@ -79,4 +80,6 @@ async def revoke_current_session(authorization: str, db: AsyncSession) -> None:
|
||||
if not authorization or not authorization.startswith("Bearer "):
|
||||
raise _unauthorized_bearer()
|
||||
token = authorization[7:]
|
||||
await redis_client.delete(f"session:{hash_token(token)}")
|
||||
deleted = await redis_client.delete(f"session:{hash_token(token)}")
|
||||
if deleted == 0:
|
||||
raise _unauthorized_bearer()
|
||||
Reference in New Issue
Block a user