#[non_exhaustive]pub enum VerifyError {
Show 14 variants
MalformedToken,
AlgorithmNotAllowed,
UnknownKey,
InvalidKey,
SignatureInvalid,
IssuerMismatch,
AudienceMismatch,
AuthorizedPartyMismatch,
AuthorizedPartyMissing,
Expired,
ImmatureToken,
NonceMismatch,
JwksUnavailable,
InvalidToken,
}Expand description
Re-exported from axum_security_oidc: the standard ID-token claim set and
the ID-token verification error (OidcContext::warm_jwks returns it).
A failure while verifying an ID token.
Every variant is a rejection reason — the token is not trusted. The distinctions exist for diagnostics/logging; a caller should treat all of them as “authentication failed”.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MalformedToken
The JWT could not be parsed (bad header, wrong number of segments, non-base64url payload).
AlgorithmNotAllowed
The token’s alg header is not in the verifier’s allow-list. Guards
against algorithm-confusion / key-substitution attacks.
UnknownKey
No key in the JWKS matches the token’s kid (or the token carried no
kid and the JWKS does not hold exactly one key).
InvalidKey
The matched JWK could not be turned into a verification key.
SignatureInvalid
The signature did not verify against the selected key.
IssuerMismatch
The iss claim did not match the expected issuer.
AudienceMismatch
The aud claim did not contain the expected audience (the client id).
AuthorizedPartyMismatch
The azp (authorized party) claim was present but did not equal the
expected audience (the client id). Per OpenID Connect Core §3.1.3.7, a
token minted for a different authorized party must not be accepted even
if it lists this client in aud.
AuthorizedPartyMissing
The token named more than one audience but carried no azp claim. Per
OpenID Connect Core §3.1.3.7 a multi-audience token must identify its
authorized party, so it cannot be attributed to this client.
Expired
The exp claim is in the past (outside the configured leeway).
ImmatureToken
The nbf claim is in the future (outside the configured leeway).
NonceMismatch
The nonce claim did not match the expected value — replay protection.
The signing keys could not be fetched from the provider’s jwks_uri
(network error, non-2xx status, or unparsable JWK set), so the token
could not be checked.
InvalidToken
A standard-claim check failed for a reason not covered above.
Trait Implementations§
Source§impl Debug for VerifyError
impl Debug for VerifyError
Source§impl Display for VerifyError
impl Display for VerifyError
Source§impl Error for VerifyError
impl Error for VerifyError
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
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for VerifyError
impl RefUnwindSafe for VerifyError
impl Send for VerifyError
impl Sync for VerifyError
impl Unpin for VerifyError
impl UnsafeUnpin for VerifyError
impl UnwindSafe for VerifyError
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> 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.