From aad11f0174219d2444e84b389f28265e51fa7ec2 Mon Sep 17 00:00:00 2001 From: Ruslan Akbashev Date: Wed, 25 Oct 2023 11:07:50 +0400 Subject: [PATCH] auth: fix clippy and fmt --- src/authentication/authentication_context.rs | 4 +++- src/authentication/authentication_service.rs | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/authentication/authentication_context.rs b/src/authentication/authentication_context.rs index eb90405..ac5e99c 100644 --- a/src/authentication/authentication_context.rs +++ b/src/authentication/authentication_context.rs @@ -100,7 +100,9 @@ where let decoded = general_purpose::STANDARD.decode(credentials)?; let utf8 = std::str::from_utf8(&decoded)?; let Some((user, pass)) = utf8.split_once(':') else { - return Err(AuthenticationError::ParseError("basic authorization formatted wrong".to_string())); + return Err(AuthenticationError::ParseError( + "basic authorization formatted wrong".to_string(), + )); }; self.validate_credentials(user, pass) diff --git a/src/authentication/authentication_service.rs b/src/authentication/authentication_service.rs index 9d04783..9d380ea 100644 --- a/src/authentication/authentication_service.rs +++ b/src/authentication/authentication_service.rs @@ -166,11 +166,9 @@ fn unauthorized_response( request: &HttpRequest, response_text: E, ) -> Result>, Error> { - let bearer_str = format!( - "Basic realm=\"Access to Baseboard Management Controller\"", - ); + let challenge = "Basic realm=\"Access to Baseboard Management Controller\""; let response = HttpResponse::Unauthorized() - .insert_header((header::WWW_AUTHENTICATE, bearer_str)) + .insert_header((header::WWW_AUTHENTICATE, challenge)) .body(response_text.to_string()); Ok(ServiceResponse::map_into_right_body(ServiceResponse::new( request.clone(),