Skip to content

Class tigrbl_auth.adapters.local_adapter.LocalAuthNAdapter

tigrbl_auth.adapters.local_adapter.LocalAuthNAdapter

Bases: AuthNProvider

Thin wrapper that plugs existing tigrbl_auth functions into the abstract interface expected by Tigrbl.

get_principal async

get_principal(request)

Delegate to tigrbl_auth.fastapi_deps.get_principal and forward whatever dict it returns.

Raises

fastapi.HTTPException(401) If the API‑key / bearer token is invalid or expired.

Source code in tigrbl_auth/adapters/local_adapter.py
32
33
34
35
36
37
38
39
40
41
42
43
44
async def get_principal(self, request: Request) -> dict:  # noqa: D401
    """
    Delegate to ``tigrbl_auth.fastapi_deps.get_principal`` and forward
    whatever dict it returns.

    Raises
    ------
    fastapi.HTTPException(401)
        If the API‑key / bearer token is invalid or expired.
    """
    principal = await get_principal(request)  # type: ignore[arg-type]
    set_auth_context(request, principal)
    return principal