haste_server/auth_n/
error.rs1use haste_fhir_operation_error::derive::OperationOutcomeError;
6
7#[derive(OperationOutcomeError, Debug)]
8pub enum AuthError {
9 #[error(code = "security", diagnostic = "Invalid CSRF token.")]
10 InvalidCsrfToken,
11 #[error(code = "security", diagnostic = "User is not logged in.")]
12 NotLoggedIn,
13 #[error(code = "invalid", diagnostic = "Invalid Authorization header.")]
14 InvalidAuthorizationHeader,
15 #[fatal(code = "exception", diagnostic = "Failed to set user in session.")]
16 SessionWriteFailed(#[from] tower_sessions::session::Error),
17 #[fatal(
18 code = "invalid",
19 diagnostic = "User does not have an email associated."
20 )]
21 UserWithoutEmail,
22 #[error(code = "not-found", diagnostic = "Invalid password reset code.")]
23 InvalidPasswordResetCode,
24 #[fatal(code = "invalid", diagnostic = "Password reset code has expired.")]
25 ExpiredPasswordResetCode,
26 #[error(code = "security", diagnostic = "Invalid OTP code.")]
27 InvalidOtpCode,
28 #[error(code = "security", diagnostic = "Invalid MFA redirect target.")]
29 InvalidMfaRedirectTarget,
30 #[error(code = "not-found", diagnostic = "User MFA credential not found.")]
31 MfaCredentialNotFound,
32 #[error(code = "exception", diagnostic = "User MFA credential ID is missing.")]
33 MfaCredentialMissingId,
34 #[error(
35 code = "not-found",
36 diagnostic = "The specified identity provider was not found."
37 )]
38 IdentityProviderNotFound,
39 #[error(
40 code = "invalid",
41 diagnostic = "Identity Provider resource is missing an ID."
42 )]
43 IdentityProviderMissingId,
44}