people endpoints and super user events built

This commit is contained in:
2025-04-13 17:28:20 +03:00
parent c3b7556e7e
commit 9a4696af77
363 changed files with 3270 additions and 264289 deletions

View File

@@ -0,0 +1,24 @@
from fastapi import Request, status
from fastapi.responses import JSONResponse
from ApiServices.IdentityService.endpoints.routes import get_safe_endpoint_urls
from ApiServices.IdentityService.config import api_config
async def token_middleware(request: Request, call_next):
base_url = request.url.path
safe_endpoints = [_[0] for _ in get_safe_endpoint_urls()]
if base_url in safe_endpoints:
return await call_next(request)
token = request.headers.get(api_config.ACCESS_TOKEN_TAG, None)
if not token:
return JSONResponse(
content={
"error": "EYS_0002",
},
status_code=status.HTTP_401_UNAUTHORIZED,
)
response = await call_next(request)
return response