83 lines
1.2 KiB
Python
83 lines
1.2 KiB
Python
class PyJWTError(Exception):
|
|
"""
|
|
Base class for all exceptions
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
class InvalidTokenError(PyJWTError):
|
|
pass
|
|
|
|
|
|
class DecodeError(InvalidTokenError):
|
|
pass
|
|
|
|
|
|
class InvalidSignatureError(DecodeError):
|
|
pass
|
|
|
|
|
|
class ExpiredSignatureError(InvalidTokenError):
|
|
pass
|
|
|
|
|
|
class InvalidAudienceError(InvalidTokenError):
|
|
pass
|
|
|
|
|
|
class InvalidIssuerError(InvalidTokenError):
|
|
pass
|
|
|
|
|
|
class InvalidIssuedAtError(InvalidTokenError):
|
|
pass
|
|
|
|
|
|
class ImmatureSignatureError(InvalidTokenError):
|
|
pass
|
|
|
|
|
|
class InvalidKeyError(PyJWTError):
|
|
pass
|
|
|
|
|
|
class InvalidAlgorithmError(InvalidTokenError):
|
|
pass
|
|
|
|
|
|
class MissingRequiredClaimError(InvalidTokenError):
|
|
def __init__(self, claim: str) -> None:
|
|
self.claim = claim
|
|
|
|
def __str__(self) -> str:
|
|
return f'Token is missing the "{self.claim}" claim'
|
|
|
|
|
|
class PyJWKError(PyJWTError):
|
|
pass
|
|
|
|
|
|
class MissingCryptographyError(PyJWKError):
|
|
pass
|
|
|
|
|
|
class PyJWKSetError(PyJWTError):
|
|
pass
|
|
|
|
|
|
class PyJWKClientError(PyJWTError):
|
|
pass
|
|
|
|
|
|
class PyJWKClientConnectionError(PyJWKClientError):
|
|
pass
|
|
|
|
|
|
class InvalidSubjectError(InvalidTokenError):
|
|
pass
|
|
|
|
|
|
class InvalidJTIError(InvalidTokenError):
|
|
pass
|