feat(auth): support trusted device (#52)
New API to maintain sessions and devices:
- GET /api/private/admin/sessions
- DELETE /api/private/admin/sessions/{session_id}
- GET /api/private/admin/trusted-devices
- DELETE /api/private/admin/trusted-devices/{device_id}
Auth:
web clients request `/oauth/token` and `/api/v2/session/verify` with `X-UUID` header to save the client as trusted device.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
15
app/dependencies/user_agent.py
Normal file
15
app/dependencies/user_agent.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Annotated
|
||||
|
||||
from app.models.model import UserAgentInfo as UserAgentInfoModel
|
||||
from app.utils import extract_user_agent
|
||||
|
||||
from fastapi import Depends, Header
|
||||
|
||||
|
||||
def get_user_agent_info(user_agent: str | None = Header(None, include_in_schema=False)) -> UserAgentInfoModel:
|
||||
return extract_user_agent(user_agent)
|
||||
|
||||
|
||||
UserAgentInfo = Annotated[UserAgentInfoModel, Depends(get_user_agent_info)]
|
||||
Reference in New Issue
Block a user