From 49f22f0fc55cde8765d962efb5406ce238366b9d Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Tue, 23 Jul 2024 13:35:29 +0800 Subject: [PATCH] fix: add back AuthBackend which is required by custom auth backend (#4409) --- src/auth/src/error.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/auth/src/error.rs b/src/auth/src/error.rs index 23c5f0d66cb9..281c45234d4b 100644 --- a/src/auth/src/error.rs +++ b/src/auth/src/error.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use common_error::ext::ErrorExt; +use common_error::ext::{BoxedError, ErrorExt}; use common_error::status_code::StatusCode; use common_macro::stack_trace_debug; use snafu::{Location, Snafu}; @@ -38,6 +38,14 @@ pub enum Error { location: Location, }, + #[snafu(display("Authentication source failure"))] + AuthBackend { + #[snafu(implicit)] + location: Location, + #[snafu(source)] + source: BoxedError, + }, + #[snafu(display("User not found, username: {}", username))] UserNotFound { username: String }, @@ -81,6 +89,7 @@ impl ErrorExt for Error { Error::FileWatch { .. } => StatusCode::InvalidArguments, Error::InternalState { .. } => StatusCode::Unexpected, Error::Io { .. } => StatusCode::StorageUnavailable, + Error::AuthBackend { .. } => StatusCode::Internal, Error::UserNotFound { .. } => StatusCode::UserNotFound, Error::UnsupportedPasswordType { .. } => StatusCode::UnsupportedPasswordType,