forked from OCA/server-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exceptions.py
54 lines (32 loc) · 1.15 KB
/
exceptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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