feat: add support for salted password hash authentication

Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-15 21:03:12 -03:00
parent fd5681b630
commit 2764f16c20
4 changed files with 57 additions and 18 deletions

View File

@@ -48,6 +48,7 @@ pub fn mode_server(
address: server_address,
port: Some(server_port),
password: settings.server_password.clone(),
password_hash: settings.server_password_hash.clone(),
};
// We need to move the connection into the async runtime
@@ -78,6 +79,7 @@ async fn run_server(
db: db_conn,
data_dir: data_dir.clone(),
password: config.password.clone(),
password_hash: config.password_hash.clone(),
};
let app = Router::new()
@@ -89,7 +91,7 @@ async fn run_server(
.with_state(state)
// Add middleware layers (applied in reverse order)
.layer(axum::middleware::from_fn(logging_middleware))
.layer(axum::middleware::from_fn(create_auth_middleware(config.password.clone())))
.layer(axum::middleware::from_fn(create_auth_middleware(config.password.clone(), config.password_hash.clone())))
.layer(
ServiceBuilder::new()
.layer(TraceLayer::new_for_http())