api: add info about how long a user session is guaranteed to be available
This commit is contained in:
parent
e59bdcadb0
commit
51349c297b
2 changed files with 3 additions and 0 deletions
|
|
@ -46,6 +46,7 @@ async def get_user_info(req: Request, current_user: deps.CurrentUser) -> UserSta
|
|||
else:
|
||||
return UserStatus(
|
||||
is_logged_in=True,
|
||||
guaranteed_session_until=datetime.fromtimestamp(current_user.id_token.exp, UTC),
|
||||
user_info=UserInfo(
|
||||
username=current_user.id_token.preferred_username,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from typing import Optional
|
||||
from datetime import datetime
|
||||
from pydantic import BaseModel
|
||||
from simple_openid_connect.data import IdToken
|
||||
|
||||
|
|
@ -13,5 +14,6 @@ class UserInfo(BaseModel):
|
|||
|
||||
class UserStatus(BaseModel):
|
||||
is_logged_in: bool
|
||||
guaranteed_session_until: datetime
|
||||
user_info: Optional[UserInfo]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue