diff --git a/meilisearch-http/src/extractors/authentication/error.rs b/meilisearch-http/src/extractors/authentication/error.rs index c1af9a3ce..6d362dcbf 100644 --- a/meilisearch-http/src/extractors/authentication/error.rs +++ b/meilisearch-http/src/extractors/authentication/error.rs @@ -5,7 +5,7 @@ pub enum AuthenticationError { #[error("The Authorization header is missing. It must use the bearer authorization method.")] MissingAuthorizationHeader, #[error("The provided API key is invalid.")] - InvalidToken(String), + InvalidToken, // Triggered on configuration error. #[error("An internal error has occurred. `Irretrievable state`.")] IrretrievableState, @@ -15,7 +15,7 @@ impl ErrorCode for AuthenticationError { fn error_code(&self) -> Code { match self { AuthenticationError::MissingAuthorizationHeader => Code::MissingAuthorizationHeader, - AuthenticationError::InvalidToken(_) => Code::InvalidToken, + AuthenticationError::InvalidToken => Code::InvalidToken, AuthenticationError::IrretrievableState => Code::Internal, } } diff --git a/meilisearch-http/src/extractors/authentication/mod.rs b/meilisearch-http/src/extractors/authentication/mod.rs index 873f7cbcd..0a0d9ecfe 100644 --- a/meilisearch-http/src/extractors/authentication/mod.rs +++ b/meilisearch-http/src/extractors/authentication/mod.rs @@ -33,7 +33,7 @@ impl
GuardedData
{ P: Policy + 'static, { match Self::authenticate(auth, token, index).await? { - (_, Some(filters)) => match data { + Some(filters) => match data { Some(data) => Ok(Self { data, filters, @@ -41,7 +41,7 @@ impl
GuardedData
{ }), None => Err(AuthenticationError::IrretrievableState.into()), }, - (token, None) => Err(AuthenticationError::InvalidToken(token).into()), + None => Err(AuthenticationError::InvalidToken.into()), } } @@ -49,7 +49,7 @@ impl
GuardedData
{ where P: Policy + 'static, { - match Self::authenticate(auth, "", None).await?.1 { + match Self::authenticate(auth, String::new(), None).await? { Some(filters) => match data { Some(data) => Ok(Self { data, @@ -62,18 +62,16 @@ impl
GuardedData
{
}
}
- async fn authenticate(
+ async fn authenticate(
auth: AuthController,
- token: S,
+ token: String,
index: Option