17 lines
441 B
Python
17 lines
441 B
Python
from typing import Annotated
|
|
from uuid import UUID
|
|
|
|
from fastapi import Depends, Request
|
|
|
|
from messenger.shared.entrypoints.errors import Unauthenticated
|
|
|
|
|
|
async def current_actor(request: Request) -> UUID:
|
|
actor = getattr(request.state, "actor", None)
|
|
if not isinstance(actor, UUID):
|
|
raise Unauthenticated("сессия не подтверждена")
|
|
return actor
|
|
|
|
|
|
type Actor = Annotated[UUID, Depends(current_actor)]
|