Skip to content

Commit

Permalink
⚰️(api) remove unused OIDCAuthenticationError
Browse files Browse the repository at this point in the history
We now use the more generic AuthenticationError that works for both OIDC
and OAuth2 password flows.
  • Loading branch information
jmaupetit committed May 29, 2024
1 parent 5f94d18 commit 42c6797
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/api/qualicharge/api/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from qualicharge.exceptions import (
AuthenticationError,
OIDCAuthenticationError,
OIDCProviderException,
PermissionDenied,
)
Expand All @@ -33,11 +32,10 @@ async def authorization_exception_handler(


@app.exception_handler(AuthenticationError)
@app.exception_handler(OIDCAuthenticationError)
@app.exception_handler(OIDCProviderException)
async def authentication_exception_handler(
request: Request,
exc: Union[AuthenticationError, OIDCAuthenticationError, OIDCProviderException],
exc: Union[AuthenticationError, OIDCProviderException],
):
"""Handle authentication errors."""
return JSONResponse(
Expand Down
2 changes: 1 addition & 1 deletion src/api/qualicharge/auth/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def get_token(
id_token (IDToken): Authenticated user ID token.
Raises:
OIDCAuthenticationError
AuthenticationError
"""
logger.debug(f"{token=}")

Expand Down
4 changes: 0 additions & 4 deletions src/api/qualicharge/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ class PermissionDenied(QualiChargeExceptionMixin, Exception):
"""Raised when authenticated user does not have required permissions."""


class OIDCAuthenticationError(QualiChargeExceptionMixin, Exception):
"""Raised when the OIDC authentication flow fails."""


class OIDCProviderException(QualiChargeExceptionMixin, Exception):
"""Raised when the OIDC provider does not behave as expected."""

Expand Down

0 comments on commit 42c6797

Please sign in to comment.