Files
mtusi2026lab2-fork/app/domain/auth.py
T

27 lines
867 B
Python

from redis.asyncio import Redis
from sqlalchemy.ext.asyncio import AsyncSession
from app.schemas.session import AuthSession
from app.schemas.user import User
async def create_session(
session: AsyncSession,
redis: Redis,
username: str,
password: str,
ttl_seconds: int,
) -> AuthSession:
"""Проверяет учётные данные и выдаёт новый Bearer-токен."""
raise NotImplementedError
async def authenticate_token(session: AsyncSession, redis: Redis, token: str) -> User:
"""Возвращает владельца действующей сессии или бросает 401."""
raise NotImplementedError
async def revoke_session(redis: Redis, token: str) -> None:
"""Отзывает текущую сессию; повторный отзыв даёт 401."""
raise NotImplementedError