From cce1285b16017755a2cd48b87c6335435bdf8b97 Mon Sep 17 00:00:00 2001 From: discord9 <55937128+discord9@users.noreply.github.com> Date: Wed, 7 May 2025 13:20:37 +0800 Subject: [PATCH] feat: flow add static user/pwd auth (#6048) * feat: flow add static user/pwd auth * fix: not print password * chore: rm explict Any bound * refactor: per review * refactor: move away from plugin * refactor: not use any * chore: per revieww * chore: complete a todo * chore: fix after rebase --- Cargo.lock | 2 ++ src/auth/src/common.rs | 20 ++++++++++- src/auth/src/error.rs | 10 +++++- src/auth/src/lib.rs | 4 ++- .../src/user_provider/static_user_provider.rs | 18 ++++++++-- src/cmd/src/flownode.rs | 26 ++++++++++++-- src/flow/Cargo.toml | 1 + src/flow/src/adapter.rs | 2 ++ src/flow/src/adapter/flownode_impl.rs | 8 +++++ src/flow/src/batching_mode/frontend_client.rs | 16 +++++++-- src/flow/src/engine.rs | 36 +++++++++++++++++++ src/flow/src/error.rs | 10 ++++-- src/flow/src/lib.rs | 4 ++- src/flow/src/server.rs | 23 ++++++++++-- src/plugins/Cargo.toml | 1 + src/plugins/src/flownode.rs | 32 +++++++++++++++++ src/plugins/src/lib.rs | 2 ++ 17 files changed, 197 insertions(+), 18 deletions(-) create mode 100644 src/plugins/src/flownode.rs diff --git a/Cargo.lock b/Cargo.lock index 6f0f9205ca..410172c750 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4264,6 +4264,7 @@ dependencies = [ "arrow-schema 54.3.1", "async-recursion", "async-trait", + "auth", "bytes", "cache", "catalog", @@ -8586,6 +8587,7 @@ dependencies = [ "common-base", "common-error", "datanode", + "flow", "frontend", "meta-srv", "serde", diff --git a/src/auth/src/common.rs b/src/auth/src/common.rs index 8a13e3fc3d..3c48f527e4 100644 --- a/src/auth/src/common.rs +++ b/src/auth/src/common.rs @@ -36,7 +36,7 @@ pub fn userinfo_by_name(username: Option) -> UserInfoRef { } pub fn user_provider_from_option(opt: &String) -> Result { - let (name, content) = opt.split_once(':').context(InvalidConfigSnafu { + let (name, content) = opt.split_once(':').with_context(|| InvalidConfigSnafu { value: opt.to_string(), msg: "UserProviderOption must be in format `