argos/argos/server/exceptions.py
Luc Didry 09a858794d
— Add built-in authentication for human interface
Built-in user management is provided too
2024-06-21 13:40:47 +02:00

13 lines
346 B
Python

from fastapi import Request
from fastapi.responses import RedirectResponse
class NotAuthenticatedException(Exception):
pass
def auth_exception_handler(request: Request, exc: NotAuthenticatedException):
"""
Redirect the user to the login page if not logged in
"""
return RedirectResponse(url=request.url_for("login_view"))