From: Michael Tremer Date: Fri, 20 Jun 2025 11:38:48 +0000 (+0000) Subject: API: auth: Add an endpoint for the currently logged in user X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb053d69114bf0c89d304b8fc2b0f3681a5f39d4;p=pbs.git API: auth: Add an endpoint for the currently logged in user Signed-off-by: Michael Tremer --- diff --git a/src/api/auth.py b/src/api/auth.py index 7cfce981..0293ff7c 100644 --- a/src/api/auth.py +++ b/src/api/auth.py @@ -209,5 +209,9 @@ async def auth_refresh(request: fastapi.Request, data: typing.Optional[RefreshRe # Send the response return AuthResponse(access_token=access_token, refresh_token=refresh_token) +@router.get("/whoami") +async def whoami(current_principal = fastapi.Depends(get_current_principal)) -> users.User: + return current_principal + # Add everything to the app apiv1.include_router(router)