exceptions.py 963 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. class PyJWTError(Exception):
  2. """
  3. Base class for all exceptions
  4. """
  5. pass
  6. class InvalidTokenError(PyJWTError):
  7. pass
  8. class DecodeError(InvalidTokenError):
  9. pass
  10. class InvalidSignatureError(DecodeError):
  11. pass
  12. class ExpiredSignatureError(InvalidTokenError):
  13. pass
  14. class InvalidAudienceError(InvalidTokenError):
  15. pass
  16. class InvalidIssuerError(InvalidTokenError):
  17. pass
  18. class InvalidIssuedAtError(InvalidTokenError):
  19. pass
  20. class ImmatureSignatureError(InvalidTokenError):
  21. pass
  22. class InvalidKeyError(PyJWTError):
  23. pass
  24. class InvalidAlgorithmError(InvalidTokenError):
  25. pass
  26. class MissingRequiredClaimError(InvalidTokenError):
  27. def __init__(self, claim):
  28. self.claim = claim
  29. def __str__(self):
  30. return f'Token is missing the "{self.claim}" claim'
  31. class PyJWKError(PyJWTError):
  32. pass
  33. class PyJWKSetError(PyJWTError):
  34. pass
  35. class PyJWKClientError(PyJWTError):
  36. pass