pub enum AuthError {
MissingHeader,
InvalidFormat,
InvalidBase64,
InvalidCredentials,
ValidationFailed(String),
CacheError(String),
ConfigError(String),
InternalError(String),
}
Expand description
Authentication error type
Variants§
MissingHeader
Missing Authorization header
InvalidFormat
Invalid format of Authorization header
InvalidBase64
Invalid Base64 encoding
InvalidCredentials
Invalid user credentials
ValidationFailed(String)
User validation failed with a message
CacheError(String)
Cache operation failed with a message
ConfigError(String)
Configuration error with a message
InternalError(String)
Internal server error with a message
Implementations§
Source§impl AuthError
impl AuthError
Sourcepub fn to_response(&self, realm: &str) -> HttpResponse
pub fn to_response(&self, realm: &str) -> HttpResponse
Create HTTP 401 response with appropriate WWW-Authenticate header
Sourcepub fn to_response_with_details(
&self,
realm: &str,
details: Option<String>,
) -> HttpResponse
pub fn to_response_with_details( &self, realm: &str, details: Option<String>, ) -> HttpResponse
Create HTTP 401 response with custom details
Sourcepub fn is_client_error(&self) -> bool
pub fn is_client_error(&self) -> bool
Check if this is a client error
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Check if this is a server error
Trait Implementations§
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)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl WebResponseError for AuthError
impl WebResponseError for AuthError
Source§fn status_code(&self) -> StatusCode
fn status_code(&self) -> StatusCode
Response’s status code Read more
Source§fn error_response(&self, _req: &HttpRequest) -> HttpResponse
fn error_response(&self, _req: &HttpRequest) -> HttpResponse
Generate response for error Read more
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
Mutably borrows from an owned value. Read more