pub enum AuthError {
Unauthorized(String),
Forbidden(String),
ValidationError {
message: String,
details: Vec<ErrorDetails>,
},
Password(PasswordError),
Jwt(JwtError),
Internal(String),
}Expand description
Error type for authentication, RBAC, and JWT operations in scyph-auth.
All variants convert to AppError via the [From<AuthError> for AppError] implementation,
making it straightforward to use ? in handlers that return Result<_, AppError>.
Variants§
Missing, invalid, expired, or revoked authentication credentials (e.g. Bearer token).
Maps to HTTP 401 Unauthorized.
Forbidden(String)
Authenticated user does not possess required role or permission.
Maps to HTTP 403 Forbidden.
ValidationError
Structured validation failure (e.g. password policy, invalid credential fields).
Maps to HTTP 422 Unprocessable Entity with per-field ErrorDetails.
Fields
details: Vec<ErrorDetails>Field-level validation error details.
Password(PasswordError)
Password hashing or verification failure.
Wraps PasswordError. Maps to HTTP 401 Unauthorized
because a password failure indicates invalid credentials.
Jwt(JwtError)
JWT encoding, decoding, or verification failure.
Wraps JwtError. Maps to HTTP 401 Unauthorized.
Internal(String)
Internal or generic authentication processing error.
Maps to HTTP 500 Internal Server Error.
Implementations§
Source§impl AuthError
impl AuthError
Sourcepub fn validation(
message: impl Into<String>,
details: Vec<ErrorDetails>,
) -> AuthError
pub fn validation( message: impl Into<String>, details: Vec<ErrorDetails>, ) -> AuthError
Constructs an AuthError::ValidationError with a summary message and field-level details.
§Arguments
message- A human-readable summary of why validation failed.details- A list ofErrorDetailsdescribing per-field failures.
§Examples
use scyph_auth::AuthError;
use scyph_core::ErrorDetails;
let err = AuthError::validation(
"Invalid credentials",
vec![ErrorDetails {
code: "REQUIRED".into(),
message: "Email is required".into(),
field: Some("email".into()),
}],
);Trait Implementations§
Source§impl Error for AuthError
impl Error for AuthError
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<PasswordError> for AuthError
impl From<PasswordError> for AuthError
Source§fn from(source: PasswordError) -> AuthError
fn from(source: PasswordError) -> AuthError
Auto Trait Implementations§
impl !RefUnwindSafe for AuthError
impl !UnwindSafe for AuthError
impl Freeze for AuthError
impl Send for AuthError
impl Sync for AuthError
impl Unpin for AuthError
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§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,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more