-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛(api) return a 403 HTTP status upon authentication failure
When an ID token expires or is invalid, we should respond with a 403 status and an appropriate error message instead of a 500.
- Loading branch information
Showing
5 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
"""QualiCharge exceptions.""" | ||
|
||
|
||
class OIDCAuthenticationError(Exception): | ||
class QualiChargeExceptionMixin: | ||
"""A mixin for QualiCharge exceptions.""" | ||
|
||
def __init__(self, name: str): | ||
"""Add name property for our exception handler.""" | ||
self.name = name | ||
|
||
|
||
class OIDCAuthenticationError(QualiChargeExceptionMixin, Exception): | ||
"""Raised when the OIDC authentication flow fails.""" | ||
|
||
|
||
class OIDCProviderException(Exception): | ||
class OIDCProviderException(QualiChargeExceptionMixin, Exception): | ||
"""Raised when the OIDC provider does not behave as expected.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters