api: add better response documentation

This commit is contained in:
lilly 2026-05-07 21:38:22 +02:00
commit 745dfaf19f
Signed by: lilly
SSH key fingerprint: SHA256:y9T5GFw2A20WVklhetIxG1+kcg/Ce0shnQmbu1LQ37g
4 changed files with 97 additions and 16 deletions

View file

@ -4,8 +4,9 @@ from datetime import datetime, UTC, timedelta
from fastapi import Request, Depends, Response
from simple_openid_connect.data import TokenSuccessResponse
from simple_openid_connect.client import OpenidClient
from cachetools import Cache
from dooris_api import models
from dooris_api import models, exceptions
logger = logging.getLogger(__name__)
@ -40,7 +41,7 @@ async def get_current_user(req: Request, resp: Response, oidc_client: OpenidClie
# otherwise we can't meaningfully recover any user information or the user is simply not authenticated
logger.debug("no currently authenticated user")
return None
raise exceptions.HttpProblemException(models.HttpProblemDetail.new_unauthorized(req.url))
def persist_auth_state(oidc_client: OpenidClient, resp: Response, tokens: TokenSuccessResponse, auth_start_time: datetime, token_nonce: Optional[str] = None):