common_access_token/
error.rs1use std::io::Error as IoError;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
8pub enum Error {
9 #[error("CBOR encoding error: {0}")]
11 CborEncode(#[from] minicbor::encode::Error<IoError>),
12
13 #[error("CBOR encoding error: {0}")]
15 CborEncodeInfallible(#[from] minicbor::encode::Error<std::convert::Infallible>),
16
17 #[error("CBOR decode error: {0}")]
19 CborDecode(#[from] minicbor::decode::Error),
20
21 #[error("Invalid token format: {0}")]
23 InvalidFormat(String),
24
25 #[error("Invalid algorithm: {0}")]
27 InvalidAlgorithm(String),
28
29 #[error("Signature verification failed. The token's signature does not match the expected signature")]
31 SignatureVerification,
32
33 #[error("Missing required claim: {0}. The token does not contain a required claim")]
35 MissingClaim(String),
36
37 #[error("Token expired. The token's expiration time (exp) is in the past")]
39 Expired,
40
41 #[error("Token not yet valid. The token's not-before time (nbf) is in the future")]
43 NotYetValid,
44
45 #[error("Invalid issuer. The token's issuer (iss) does not match the expected issuer")]
47 InvalidIssuer,
48
49 #[error("Invalid audience. The token's audience (aud) does not match the expected audience")]
51 InvalidAudience,
52
53 #[error("Invalid claim value: {0}")]
55 InvalidClaimValue(String),
56
57 #[error("Invalid URI claim: {0}")]
59 InvalidUriClaim(String),
60
61 #[error("Invalid method claim: {0}")]
63 InvalidMethodClaim(String),
64
65 #[error("Invalid renewal claim: {0}")]
67 InvalidRenewalClaim(String),
68
69 #[error("Token replay violation: {0}")]
71 ReplayViolation(String),
72
73 #[error("Other error: {0}")]
75 Other(String),
76}