Skip to content

Commit

Permalink
auth: fix clippy and fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslashev committed Oct 25, 2023
1 parent ae15f5f commit aad11f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/authentication/authentication_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions src/authentication/authentication_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,9 @@ fn unauthorized_response<B, E: ToString>(
request: &HttpRequest,
response_text: E,
) -> Result<ServiceResponse<EitherBody<B>>, 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(),
Expand Down

0 comments on commit aad11f0

Please sign in to comment.