Imporve gateway auth for all services

This commit is contained in:
Urtzi Alfaro
2025-07-21 14:41:33 +02:00
parent df7c6e1e00
commit 2d85dd3e9e
6 changed files with 188 additions and 63 deletions

View File

@@ -4,7 +4,7 @@ User management API routes
from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.ext.asyncio import AsyncSession
from typing import List
from typing import Dict, Any
import structlog
from app.core.database import get_db
@@ -14,12 +14,19 @@ from app.services.user_service import UserService
from app.core.auth import get_current_user
from app.models.users import User
# Import unified authentication from shared library
from shared.auth.decorators import (
get_current_user_dep,
get_current_tenant_id_dep,
require_role # For admin-only endpoints
)
logger = structlog.get_logger()
router = APIRouter()
@router.get("/me", response_model=UserResponse)
async def get_current_user_info(
current_user: User = Depends(get_current_user),
current_user: Dict[str, Any] = Depends(get_current_user_dep),
db: AsyncSession = Depends(get_db)
):
"""Get current user information"""