Initial commit: OCA Server Auth packages (29 packages)

This commit is contained in:
Ernad Husremovic 2025-08-29 15:43:06 +02:00
commit 3ed80311c4
1325 changed files with 127292 additions and 0 deletions

View file

@ -0,0 +1,54 @@
# Copyright 2021 ACSONE SA/NV
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl)
from werkzeug.exceptions import InternalServerError, Unauthorized
class UnauthorizedMissingAuthorizationHeader(Unauthorized):
pass
class UnauthorizedMissingCookie(Unauthorized):
pass
class UnauthorizedMalformedAuthorizationHeader(Unauthorized):
pass
class UnauthorizedSessionMismatch(Unauthorized):
pass
class AmbiguousJwtValidator(InternalServerError):
pass
class JwtValidatorNotFound(InternalServerError):
pass
class UnauthorizedInvalidToken(Unauthorized):
pass
class UnauthorizedPartnerNotFound(Unauthorized):
pass
class UnauthorizedCompositeJwtError(Unauthorized):
"""Indicate that multiple errors occurred during JWT chain validation."""
def __init__(self, errors):
self.errors = errors
super().__init__(
"Multiple errors occurred during JWT chain validation:\n"
+ "\n".join(
"{}: {}".format(validator_name, error)
for validator_name, error in self.errors.items()
)
)
class ConfigurationError(InternalServerError):
pass