MCPcopy Create free account
hub / github.com/dbunt1tled/python-fast-api / get_auth_state

Function get_auth_state

src/core/http/request/state.py:27–37  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

25
26
27def get_auth_state(request: Request) -> AuthState:
28 if (
29 not hasattr(request.state, "user")
30 or request.state.user is None
31 or not hasattr(request.state, "is_authenticated")
32 or not request.state.is_authenticated
33 ):
34 raise UnauthorizedException(
35 error_no=ErrorNo.AUTHORIZATION_USER_NOT_AUTHENTICATED, message="User is not authenticated"
36 )
37 return cast(AuthState, request.state)

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected