diff options
-rw-r--r-- | backend/routes/index.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/backend/routes/index.py b/backend/routes/index.py index 8144723..b37f381 100644 --- a/backend/routes/index.py +++ b/backend/routes/index.py @@ -18,7 +18,19 @@ class IndexRoute(Route): path = "/" def get(self, request: Request) -> JSONResponse: - return JSONResponse({ + response_data = { "message": "Hello, world!", - "client": request.client.host - }) + "client": request.client.host, + "user": { + "authenticated": False + } + } + + if request.user.is_authenticated: + response_data["user"] = { + "authenticated": True, + "user": request.user.payload, + "scopes": request.auth.scopes + } + + return JSONResponse(response_data) |