From 102e2308890ff59a1b789ad131c224391a795ddd Mon Sep 17 00:00:00 2001 From: Yang Xiufeng Date: Thu, 5 Sep 2024 00:01:09 +0800 Subject: [PATCH] feat: discovery_nodes not need auth. --- Cargo.lock | 1 + src/query/service/src/auth.rs | 2 ++ src/query/service/src/servers/http/http_services.rs | 2 +- src/query/service/src/servers/http/middleware.rs | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 8f09dbd5ae094..2d7f73afa8e01 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3634,6 +3634,7 @@ dependencies = [ "databend-common-meta-stoerr", "databend-common-meta-types", "databend-common-proto-conv", + "enumflags2", "fastrace", "futures", "log", diff --git a/src/query/service/src/auth.rs b/src/query/service/src/auth.rs index 833db58e525f6..1d8386050dc16 100644 --- a/src/query/service/src/auth.rs +++ b/src/query/service/src/auth.rs @@ -50,6 +50,7 @@ pub enum Credential { password: Option>, client_ip: Option, }, + NoNeed, } impl AuthMgr { @@ -79,6 +80,7 @@ impl AuthMgr { ) -> Result> { let user_api = UserApiProvider::instance(); match credential { + Credential::NoNeed => Ok(None), Credential::DatabendToken { token, set_user, diff --git a/src/query/service/src/servers/http/http_services.rs b/src/query/service/src/servers/http/http_services.rs index 18e5afb5dcf8a..ad5df4202c657 100644 --- a/src/query/service/src/servers/http/http_services.rs +++ b/src/query/service/src/servers/http/http_services.rs @@ -142,7 +142,7 @@ impl HttpHandler { "/discovery_nodes", get(discovery_nodes).with(HTTPSessionMiddleware::create( self.kind, - EndpointKind::StartQuery, + EndpointKind::NoAuth, )), ); diff --git a/src/query/service/src/servers/http/middleware.rs b/src/query/service/src/servers/http/middleware.rs index d4624295c2b18..7fd0e0158f5bd 100644 --- a/src/query/service/src/servers/http/middleware.rs +++ b/src/query/service/src/servers/http/middleware.rs @@ -75,6 +75,7 @@ pub enum EndpointKind { StartQuery, PollQuery, Clickhouse, + NoAuth, } const USER_AGENT: &str = "User-Agent";