From 8c052c091e9a716b8a2eaa52b2373ab9e2af5e20 Mon Sep 17 00:00:00 2001 From: Valentin Tolmer Date: Thu, 13 Apr 2023 09:32:53 +0200 Subject: [PATCH] fix hipb typo --- server/src/infra/auth_service.rs | 10 +++++----- server/src/infra/cli.rs | 4 ++-- server/src/infra/configuration.rs | 6 +++--- server/src/infra/tcp_server.rs | 12 ++++++------ 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/server/src/infra/auth_service.rs b/server/src/infra/auth_service.rs index 81d9989..9b06566 100644 --- a/server/src/infra/auth_service.rs +++ b/server/src/infra/auth_service.rs @@ -501,10 +501,10 @@ async fn get_password_hash_list( .header("hibp-api-key", api_key.unsecure()) .send() .await - .context("Could not get response from HIPB")? + .context("Could not get response from HIBP")? .text() .await?; - parse_hash_list(&resp).context("Invalid HIPB response") + parse_hash_list(&resp).context("Invalid HIBP response") } async fn check_password_pwned( @@ -536,8 +536,8 @@ where "No token or invalid token".to_string(), )); } - if data.hipb_api_key.unsecure().is_empty() { - return Err(TcpError::NotImplemented("No HIPB API key".to_string())); + if data.hibp_api_key.unsecure().is_empty() { + return Err(TcpError::NotImplemented("No HIBP API key".to_string())); } let hash = request .match_info() @@ -549,7 +549,7 @@ where hash ))); } - get_password_hash_list(hash, &data.hipb_api_key) + get_password_hash_list(hash, &data.hibp_api_key) .await .map(|hashes| HttpResponse::Ok().json(hashes)) .map_err(|e| TcpError::InternalServerError(e.to_string())) diff --git a/server/src/infra/cli.rs b/server/src/infra/cli.rs index fc1a5ed..ebb31e8 100644 --- a/server/src/infra/cli.rs +++ b/server/src/infra/cli.rs @@ -82,8 +82,8 @@ pub struct RunOpts { pub database_url: Option, /// HaveIBeenPwned API key, to check passwords against leaks. - #[clap(long, env = "LLDAP_HIPB_API_KEY")] - pub hipb_api_key: Option, + #[clap(long, env = "LLDAP_HIBP_API_KEY")] + pub hibp_api_key: Option, #[clap(flatten)] pub smtp_opts: SmtpOpts, diff --git a/server/src/infra/configuration.rs b/server/src/infra/configuration.rs index bd75eba..183a8f6 100644 --- a/server/src/infra/configuration.rs +++ b/server/src/infra/configuration.rs @@ -99,7 +99,7 @@ pub struct Configuration { #[builder(default = r#"String::from("http://localhost")"#)] pub http_url: String, #[builder(default = r#"SecUtf8::from("")"#)] - pub hipb_api_key: SecUtf8, + pub hibp_api_key: SecUtf8, #[serde(skip)] #[builder(field(private), default = "None")] server_setup: Option, @@ -216,8 +216,8 @@ impl ConfigOverrider for RunOpts { config.database_url = database_url.to_string(); } - if let Some(api_key) = self.hipb_api_key.as_ref() { - config.hipb_api_key = SecUtf8::from(api_key.clone()); + if let Some(api_key) = self.hibp_api_key.as_ref() { + config.hibp_api_key = SecUtf8::from(api_key.clone()); } self.smtp_opts.override_config(config); self.ldaps_opts.override_config(config); diff --git a/server/src/infra/tcp_server.rs b/server/src/infra/tcp_server.rs index 280815e..d4b4810 100644 --- a/server/src/infra/tcp_server.rs +++ b/server/src/infra/tcp_server.rs @@ -89,7 +89,7 @@ fn http_config( jwt_blacklist: HashSet, server_url: String, mail_options: MailOptions, - hipb_api_key: SecUtf8, + hibp_api_key: SecUtf8, ) where Backend: TcpBackendHandler + BackendHandler + LoginHandler + OpaqueHandler + Clone + 'static, { @@ -100,7 +100,7 @@ fn http_config( jwt_blacklist: RwLock::new(jwt_blacklist), server_url, mail_options, - hipb_api_key, + hibp_api_key, })) .route( "/health", @@ -136,7 +136,7 @@ pub(crate) struct AppState { pub jwt_blacklist: RwLock>, pub server_url: String, pub mail_options: MailOptions, - pub hipb_api_key: SecUtf8, + pub hibp_api_key: SecUtf8, } impl AppState { @@ -177,7 +177,7 @@ where let mail_options = config.smtp_options.clone(); let verbose = config.verbose; info!("Starting the API/web server on port {}", config.http_port); - let hipb_api_key = config.hipb_api_key.clone(); + let hibp_api_key = config.hibp_api_key.clone(); server_builder .bind( "http", @@ -188,7 +188,7 @@ where let jwt_blacklist = jwt_blacklist.clone(); let server_url = server_url.clone(); let mail_options = mail_options.clone(); - let hipb_api_key = hipb_api_key.clone(); + let hibp_api_key = hibp_api_key.clone(); HttpServiceBuilder::default() .finish(map_config( App::new() @@ -204,7 +204,7 @@ where jwt_blacklist, server_url, mail_options, - hipb_api_key, + hibp_api_key, ) }), |_| AppConfig::default(),