финальные evidence для lab2 + кэширование

This commit is contained in:
2026-10-01 03:50:54 +03:00
parent 2b90834d03
commit 43e5964180
9 changed files with 371 additions and 7 deletions
+4 -1
View File
@@ -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()