V1 Integration (#11183)

Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: sp.wack <83104063+amanape@users.noreply.github.com>
Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
This commit is contained in:
Tim O'Farrell
2025-10-13 20:16:44 -06:00
committed by GitHub
parent 5076f21e86
commit f292f3a84d
115 changed files with 13086 additions and 264 deletions

View File

@@ -0,0 +1,23 @@
"""User router for OpenHands Server. For the moment, this simply implements the /me endpoint."""
from fastapi import APIRouter, HTTPException, status
from openhands.app_server.config import depends_user_context
from openhands.app_server.user.user_context import UserContext
from openhands.app_server.user.user_models import UserInfo
router = APIRouter(prefix='/users', tags=['User'])
user_dependency = depends_user_context()
# Read methods
@router.get('/me')
async def get_current_user(
user_context: UserContext = user_dependency,
) -> UserInfo:
"""Get the current authenticated user."""
user = await user_context.get_user_info()
if user is None:
raise HTTPException(status.HTTP_401_UNAUTHORIZED, detail='Not authenticated')
return user