pub enum AuthError {
Show 15 variants
InvalidCredentials,
TokenError {
message: String,
},
SessionError {
message: String,
},
UserNotFound,
UserDisabled,
AccountLocked,
MfaRequired,
InvalidMfaCode,
AccessDenied {
message: String,
},
RoleNotFound {
role: String,
},
PermissionNotFound {
permission: String,
},
ConfigurationError {
message: String,
},
CryptographicError {
message: String,
},
DatabaseError {
message: String,
},
Generic {
message: String,
},
}Expand description
Authentication and authorization errors
Variants§
InvalidCredentials
Invalid credentials provided
TokenError
Token-related errors
SessionError
Session-related errors
UserNotFound
User not found
UserDisabled
User account is disabled
AccountLocked
Account is locked due to failed attempts
MfaRequired
Multi-factor authentication required
InvalidMfaCode
Invalid MFA code
AccessDenied
Authorization/permission errors
RoleNotFound
Role not found
PermissionNotFound
Permission not found
ConfigurationError
Configuration errors
CryptographicError
Cryptographic errors
DatabaseError
Database errors
Generic
Generic authentication error
Implementations§
Source§impl AuthError
impl AuthError
Sourcepub fn error_code(&self) -> &'static str
pub fn error_code(&self) -> &'static str
Get the error code for API responses
Sourcepub fn status_code(&self) -> u16
pub fn status_code(&self) -> u16
Get HTTP status code for the error
Sourcepub fn token_error(message: impl Into<String>) -> Self
pub fn token_error(message: impl Into<String>) -> Self
Create a token error
Sourcepub fn session_error(message: impl Into<String>) -> Self
pub fn session_error(message: impl Into<String>) -> Self
Create a session error
Sourcepub fn access_denied(message: impl Into<String>) -> Self
pub fn access_denied(message: impl Into<String>) -> Self
Create an access denied error
Sourcepub fn config_error(message: impl Into<String>) -> Self
pub fn config_error(message: impl Into<String>) -> Self
Create a configuration error
Sourcepub fn crypto_error(message: impl Into<String>) -> Self
pub fn crypto_error(message: impl Into<String>) -> Self
Create a cryptographic error
Sourcepub fn database_error(message: impl Into<String>) -> Self
pub fn database_error(message: impl Into<String>) -> Self
Create a database error
Sourcepub fn generic_error(message: impl Into<String>) -> Self
pub fn generic_error(message: impl Into<String>) -> Self
Create a generic error
Sourcepub fn authentication_failed(message: impl Into<String>) -> Self
pub fn authentication_failed(message: impl Into<String>) -> Self
Create an authentication failed error (alias for InvalidCredentials with message)
Sourcepub fn configuration_error(message: impl Into<String>) -> Self
pub fn configuration_error(message: impl Into<String>) -> Self
Create a configuration error (alias for config_error)
Sourcepub fn insufficient_permissions(message: impl Into<String>) -> Self
pub fn insufficient_permissions(message: impl Into<String>) -> Self
Create an insufficient permissions error (alias for access_denied)
Create an unauthorized error (alias for InvalidCredentials with message)
Sourcepub fn invalid_credentials(message: impl Into<String>) -> Self
pub fn invalid_credentials(message: impl Into<String>) -> Self
Create an invalid credentials error with message
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AuthError
impl<'de> Deserialize<'de> for AuthError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Error for AuthError
impl Error for AuthError
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
Source§impl From<BcryptError> for AuthError
impl From<BcryptError> for AuthError
Source§fn from(err: BcryptError) -> Self
fn from(err: BcryptError) -> Self
impl Eq for AuthError
impl StructuralPartialEq for AuthError
Auto Trait Implementations§
impl Freeze for AuthError
impl RefUnwindSafe for AuthError
impl Send for AuthError
impl Sync for AuthError
impl Unpin for AuthError
impl UnwindSafe for AuthError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 more