pub enum TokenError {
Expired,
Invalid {
message: String,
},
NotFound,
Missing,
CreationFailed {
message: String,
},
RefreshFailed {
message: String,
},
RevocationFailed {
message: String,
},
}Expand description
Token-specific errors.
Covers the lifecycle of authentication tokens: creation, validation, refresh, and revocation.
Variants§
Expired
The token’s exp claim is in the past.
Invalid
The token failed signature verification or structural validation.
NotFound
No token matching the given identifier exists in the store.
Missing
The request did not include a required token (e.g. missing Authorization header).
CreationFailed
A new token could not be issued (e.g. signing key unavailable).
RefreshFailed
An existing token could not be refreshed (e.g. refresh token revoked).
RevocationFailed
Token revocation did not complete (e.g. storage write failure).
Implementations§
Source§impl TokenError
impl TokenError
Sourcepub fn creation_failed(message: impl Into<String>) -> Self
pub fn creation_failed(message: impl Into<String>) -> Self
Create a new token creation failed error.
§Example
use auth_framework::errors::TokenError;
let err = TokenError::creation_failed("signing key unavailable");
assert!(err.to_string().contains("signing key unavailable"));Sourcepub fn refresh_failed(message: impl Into<String>) -> Self
pub fn refresh_failed(message: impl Into<String>) -> Self
Create a new token refresh failed error.
§Example
use auth_framework::errors::TokenError;
let err = TokenError::refresh_failed("refresh token revoked");
assert!(err.to_string().contains("refresh token revoked"));Sourcepub fn revocation_failed(message: impl Into<String>) -> Self
pub fn revocation_failed(message: impl Into<String>) -> Self
Create a new token revocation failed error.
§Example
use auth_framework::errors::TokenError;
let err = TokenError::revocation_failed("storage write failed");
assert!(err.to_string().contains("storage write failed"));Trait Implementations§
Source§impl Debug for TokenError
impl Debug for TokenError
Source§impl Display for TokenError
impl Display for TokenError
Source§impl Error for TokenError
impl Error for TokenError
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()
Source§impl From<TokenError> for AuthError
impl From<TokenError> for AuthError
Source§fn from(source: TokenError) -> Self
fn from(source: TokenError) -> Self
Auto Trait Implementations§
impl Freeze for TokenError
impl RefUnwindSafe for TokenError
impl Send for TokenError
impl Sync for TokenError
impl Unpin for TokenError
impl UnsafeUnpin for TokenError
impl UnwindSafe for TokenError
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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.