Skip to main content

JwtValidationError

Enum JwtValidationError 

Source
pub enum JwtValidationError {
Show 16 variants Parse { source: JwsParseError, }, Signature { source: VerifyError, }, UnsignedToken, DisallowedAlgorithm { alg: String, }, UnrecognizedCriticalHeader { params: Vec<String>, }, Expired { expiration: SystemTime, now: SystemTime, }, NotYetValid { not_before: SystemTime, now: SystemTime, }, IssuedInFuture { issued_at: SystemTime, now: SystemTime, }, TokenTooOld { issued_at: SystemTime, max_token_age: Duration, }, InvalidTokenType { typ: Option<String>, }, ClaimMismatch { claim: &'static str, expected: String, actual: String, }, RequiredClaimMissing { claim: &'static str, }, JtiTooLong { len: usize, max_len: usize, }, JtiNotUnique, JtiCheck { source: Error, }, ExtraClaims { source: Error, },
}
Expand description

Validation errors that can occur while processing a JWT.

Variants§

§

Parse

The token could not be parsed as a compact JWS.

Fields

§source: JwsParseError

The underlying error.

§

Signature

The token signature is invalid.

Fields

§source: VerifyError

The underlying error.

§

UnsignedToken

The token is unsigned.

§

DisallowedAlgorithm

The token uses a disallowed signature algorithm.

Fields

§alg: String

The algorithm used by the token.

§

UnrecognizedCriticalHeader

The token contains unrecognized critical header parameters.

Fields

§params: Vec<String>

The unrecognized critical header parameters.

§

Expired

The token is expired.

Fields

§expiration: SystemTime

The expiration timestamp of the JWT.

§now: SystemTime

The current time.

§

NotYetValid

The token is not yet valid.

Fields

§not_before: SystemTime

The not-before timestamp of the JWT.

§now: SystemTime

The current time.

§

IssuedInFuture

The token is issued in the future.

Fields

§issued_at: SystemTime

The issued-at timestamp of the JWT.

§now: SystemTime

The current time.

§

TokenTooOld

The token is too old.

Fields

§issued_at: SystemTime

The issued-at timestamp of the JWT.

§max_token_age: Duration

The maximum age of the token.

§

InvalidTokenType

The token type claim is invalid.

Fields

§typ: Option<String>

The type of the JWT.

§

ClaimMismatch

A claim did not match the expected value.

Fields

§claim: &'static str

The claim name.

§expected: String

The expected value.

§actual: String

The actual value.

§

RequiredClaimMissing

A required claim is missing from the JWT.

Fields

§claim: &'static str

The missing claim.

§

JtiTooLong

The jti claim exceeds the maximum allowed length.

Fields

§len: usize

The length of the jti value in bytes.

§max_len: usize

The maximum allowed length in bytes.

§

JtiNotUnique

The JTI was required to be unique, but was previously marked as seen.

§

JtiCheck

There was an internal failure when attempting to check for JTI uniqueness.

Fields

§source: Error

The underlying error.

§

ExtraClaims

The token is structurally valid but does not contain the required extra claims.

Fields

§source: Error

The underlying deserialization error.

Trait Implementations§

Source§

impl Debug for JwtValidationError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for JwtValidationError

Source§

fn fmt(&self, __snafu_display_formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for JwtValidationError
where Self: Debug + Display,

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl ErrorCompat for JwtValidationError

Source§

fn backtrace(&self) -> Option<&Backtrace>

Returns a Backtrace that may be printed.
Source§

fn iter_chain(&self) -> ChainCompat<'_, '_>
where Self: AsErrorSource,

Returns an iterator for traversing the chain of errors, starting with the current error and continuing with recursive calls to Error::source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsErrorSource for T
where T: Error + 'static,

Source§

fn as_error_source(&self) -> &(dyn Error + 'static)

For maximum effectiveness, this needs to be called as a method to benefit from Rust’s automatic dereferencing of method receivers.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSendSync for T
where T: Send + Sync,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.