pub enum JWTError {
Show 18 variants
InvalidFormat,
InvalidHeader,
UnsupportedAlgorithm {
algorithm: String,
key_type: String,
},
InvalidClaims,
InvalidSignature,
SystemTimeError,
TokenExpired,
TokenNotValidYet,
SignatureVerificationFailed,
InvalidPayload,
InvalidPayloadJson,
MissingClaim {
claim: String,
},
InvalidTokenType {
expected: String,
actual: String,
},
HttpMethodMismatch {
expected: String,
actual: String,
},
HttpUriMismatch {
expected: String,
actual: String,
},
AccessTokenHashMismatch,
InvalidNonce {
nonce: String,
},
InvalidTimestamp {
reason: String,
},
}
Expand description
Error types that can occur when working with JSON Web Tokens
Variants§
InvalidFormat
Occurs when JWT does not have the expected 3-part format (header.payload.signature)
InvalidHeader
Occurs when JWT header cannot be base64 decoded or parsed as JSON
UnsupportedAlgorithm
Occurs when JWT algorithm does not match the provided key type
Fields
InvalidClaims
Occurs when JWT claims cannot be base64 decoded or parsed as JSON
InvalidSignature
Occurs when JWT signature cannot be base64 decoded
SystemTimeError
Occurs when system time cannot be obtained for timestamp validation
TokenExpired
Occurs when JWT has passed its expiration time
TokenNotValidYet
Occurs when JWT is used before its not-before time
SignatureVerificationFailed
Occurs when signature verification fails
InvalidPayload
Occurs when JWT payload cannot be base64 decoded
InvalidPayloadJson
Occurs when JWT payload cannot be parsed as JSON
MissingClaim
Occurs when a required JWT claim is missing
InvalidTokenType
Occurs when JWT type field has wrong value
HttpMethodMismatch
Occurs when HTTP method in JWT doesn’t match expected value
HttpUriMismatch
Occurs when HTTP URI in JWT doesn’t match expected value
AccessTokenHashMismatch
Occurs when access token hash validation fails
InvalidNonce
Occurs when nonce value is not in the expected values list
InvalidTimestamp
Occurs when JWT has invalid timestamp claim
Trait Implementations§
Source§impl Error for JWTError
impl Error for JWTError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Auto Trait Implementations§
impl Freeze for JWTError
impl RefUnwindSafe for JWTError
impl Send for JWTError
impl Sync for JWTError
impl Unpin for JWTError
impl UnwindSafe for JWTError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.