Files
romm/backend/exceptions/auth_exceptions.py
2025-01-07 17:28:13 -05:00

38 lines
1.0 KiB
Python

from fastapi import HTTPException, status
UserPassDisabledException = HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail="Username/password authentication disabled",
)
AuthCredentialsException = HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Incorrect username or password",
)
AuthenticationSchemeException = HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Invalid authentication scheme",
)
UserDisabledException = HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Disabled user",
)
OAuthCredentialsException = HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Could not validate credentials",
headers={"WWW-Authenticate": "Bearer"},
)
OIDCDisabledException = HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail="OAuth disabled",
)
OIDCNotConfiguredException = HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail="OAuth not configured",
)