From 1273b8311f3883da7b7fcd1d444bba659267db19 Mon Sep 17 00:00:00 2001 From: yanand0909 Date: Wed, 12 Nov 2025 19:14:21 +0530 Subject: [PATCH] [MATRIX-1216] added basic auth support for mcp connections --- pkg/flink/utils.go | 8 ++++---- test/fixtures/output/flink/connection/create-help.golden | 4 ++-- .../create/create-a2a-missing-required-secret.golden | 4 ++-- .../create/create-a2a-mutually-exclusive-secret.golden | 4 ++-- .../create-mcp_server-missing-required-secret.golden | 4 ++-- .../create-mcp_server-mutually-exclusive-secret.golden | 4 ++-- .../connection/create/create-mcp_server-no-secret.golden | 2 +- .../create/create-missing-required-secret.golden | 4 ++-- .../create/create-rest-missing-required-secret.golden | 4 ++-- .../create/create-rest-mutually-exclusive-secret.golden | 4 ++-- test/fixtures/output/flink/connection/update-help.golden | 4 ++-- test/flink_test.go | 1 + 12 files changed, 24 insertions(+), 23 deletions(-) diff --git a/pkg/flink/utils.go b/pkg/flink/utils.go index 5925a6f57e..304f2b6ff2 100644 --- a/pkg/flink/utils.go +++ b/pkg/flink/utils.go @@ -17,7 +17,7 @@ var ( "couchbase": {"username", "password"}, "confluent_jdbc": {"username", "password"}, "rest": {"username", "password", "token", "token-endpoint", "client-id", "client-secret", "scope"}, - "mcp_server": {"api-key", "token", "token-endpoint", "client-id", "client-secret", "scope", "sse-endpoint", "transport-type"}, + "mcp_server": {"username", "password", "api-key", "token", "token-endpoint", "client-id", "client-secret", "scope", "sse-endpoint", "transport-type"}, } ConnectionSecretTypeMapping = map[string][]string{ @@ -26,8 +26,8 @@ var ( "aws-secret-key": {"bedrock", "sagemaker"}, "aws-session-token": {"bedrock", "sagemaker"}, "service-key": {"vertexai"}, - "username": {"mongodb", "couchbase", "confluent_jdbc", "a2a", "rest"}, - "password": {"mongodb", "couchbase", "confluent_jdbc", "a2a", "rest"}, + "username": {"mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", "mcp_server"}, + "password": {"mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", "mcp_server"}, "token": {"a2a", "rest", "mcp_server"}, "token-endpoint": {"a2a", "rest", "mcp_server"}, "client-id": {"a2a", "rest", "mcp_server"}, @@ -58,7 +58,7 @@ var ( ConnectionOneOfRequiredSecretsMapping = map[string][][]string{ "a2a": {{"api-key"}, {"username", "password"}, {"token"}, {"token-endpoint", "client-id", "client-secret", "scope"}}, "rest": {{"username", "password"}, {"token"}, {"token-endpoint", "client-id", "client-secret", "scope"}}, - "mcp_server": {{"api-key"}, {"token"}, {"token-endpoint", "client-id", "client-secret", "scope"}}, + "mcp_server": {{"api-key"}, {"username", "password"}, {"token"}, {"token-endpoint", "client-id", "client-secret", "scope"}}, } ConnectionSecretAllowedValues = map[string][]string{ diff --git a/test/fixtures/output/flink/connection/create-help.golden b/test/fixtures/output/flink/connection/create-help.golden index c292d7ead4..ed7580bcea 100644 --- a/test/fixtures/output/flink/connection/create-help.golden +++ b/test/fixtures/output/flink/connection/create-help.golden @@ -18,8 +18,8 @@ Flags: --aws-secret-key string Specify secret key for the type: "bedrock" or "sagemaker". --aws-session-token string Specify session token for the type: "bedrock" or "sagemaker". --service-key string Specify service key for the type: "vertexai". - --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". - --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". + --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". + --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". --token string Specify bearer token for the type: "a2a", "rest", or "mcp_server". --token-endpoint string Specify OAuth2 token endpoint for the type: "a2a", "rest", or "mcp_server". --client-id string Specify OAuth2 client ID for the type: "a2a", "rest", or "mcp_server". diff --git a/test/fixtures/output/flink/connection/create/create-a2a-missing-required-secret.golden b/test/fixtures/output/flink/connection/create/create-a2a-missing-required-secret.golden index d5ac36441c..c4d6256598 100644 --- a/test/fixtures/output/flink/connection/create/create-a2a-missing-required-secret.golden +++ b/test/fixtures/output/flink/connection/create/create-a2a-missing-required-secret.golden @@ -17,8 +17,8 @@ Flags: --aws-secret-key string Specify secret key for the type: "bedrock" or "sagemaker". --aws-session-token string Specify session token for the type: "bedrock" or "sagemaker". --service-key string Specify service key for the type: "vertexai". - --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". - --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". + --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". + --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". --token string Specify bearer token for the type: "a2a", "rest", or "mcp_server". --token-endpoint string Specify OAuth2 token endpoint for the type: "a2a", "rest", or "mcp_server". --client-id string Specify OAuth2 client ID for the type: "a2a", "rest", or "mcp_server". diff --git a/test/fixtures/output/flink/connection/create/create-a2a-mutually-exclusive-secret.golden b/test/fixtures/output/flink/connection/create/create-a2a-mutually-exclusive-secret.golden index 2822613594..84cb9a7aef 100644 --- a/test/fixtures/output/flink/connection/create/create-a2a-mutually-exclusive-secret.golden +++ b/test/fixtures/output/flink/connection/create/create-a2a-mutually-exclusive-secret.golden @@ -17,8 +17,8 @@ Flags: --aws-secret-key string Specify secret key for the type: "bedrock" or "sagemaker". --aws-session-token string Specify session token for the type: "bedrock" or "sagemaker". --service-key string Specify service key for the type: "vertexai". - --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". - --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". + --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". + --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". --token string Specify bearer token for the type: "a2a", "rest", or "mcp_server". --token-endpoint string Specify OAuth2 token endpoint for the type: "a2a", "rest", or "mcp_server". --client-id string Specify OAuth2 client ID for the type: "a2a", "rest", or "mcp_server". diff --git a/test/fixtures/output/flink/connection/create/create-mcp_server-missing-required-secret.golden b/test/fixtures/output/flink/connection/create/create-mcp_server-missing-required-secret.golden index d5ac36441c..c4d6256598 100644 --- a/test/fixtures/output/flink/connection/create/create-mcp_server-missing-required-secret.golden +++ b/test/fixtures/output/flink/connection/create/create-mcp_server-missing-required-secret.golden @@ -17,8 +17,8 @@ Flags: --aws-secret-key string Specify secret key for the type: "bedrock" or "sagemaker". --aws-session-token string Specify session token for the type: "bedrock" or "sagemaker". --service-key string Specify service key for the type: "vertexai". - --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". - --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". + --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". + --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". --token string Specify bearer token for the type: "a2a", "rest", or "mcp_server". --token-endpoint string Specify OAuth2 token endpoint for the type: "a2a", "rest", or "mcp_server". --client-id string Specify OAuth2 client ID for the type: "a2a", "rest", or "mcp_server". diff --git a/test/fixtures/output/flink/connection/create/create-mcp_server-mutually-exclusive-secret.golden b/test/fixtures/output/flink/connection/create/create-mcp_server-mutually-exclusive-secret.golden index 2822613594..84cb9a7aef 100644 --- a/test/fixtures/output/flink/connection/create/create-mcp_server-mutually-exclusive-secret.golden +++ b/test/fixtures/output/flink/connection/create/create-mcp_server-mutually-exclusive-secret.golden @@ -17,8 +17,8 @@ Flags: --aws-secret-key string Specify secret key for the type: "bedrock" or "sagemaker". --aws-session-token string Specify session token for the type: "bedrock" or "sagemaker". --service-key string Specify service key for the type: "vertexai". - --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". - --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". + --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". + --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". --token string Specify bearer token for the type: "a2a", "rest", or "mcp_server". --token-endpoint string Specify OAuth2 token endpoint for the type: "a2a", "rest", or "mcp_server". --client-id string Specify OAuth2 client ID for the type: "a2a", "rest", or "mcp_server". diff --git a/test/fixtures/output/flink/connection/create/create-mcp_server-no-secret.golden b/test/fixtures/output/flink/connection/create/create-mcp_server-no-secret.golden index 22be94d2bb..a1f98eca03 100644 --- a/test/fixtures/output/flink/connection/create/create-mcp_server-no-secret.golden +++ b/test/fixtures/output/flink/connection/create/create-mcp_server-no-secret.golden @@ -1 +1 @@ -Error: no secrets provided for type mcp_server, one of the required secrets "[api-key]", "[token]", or "[token-endpoint client-id client-secret scope]" must be provided +Error: no secrets provided for type mcp_server, one of the required secrets "[api-key]", "[username password]", "[token]", or "[token-endpoint client-id client-secret scope]" must be provided diff --git a/test/fixtures/output/flink/connection/create/create-missing-required-secret.golden b/test/fixtures/output/flink/connection/create/create-missing-required-secret.golden index d4811fb448..4b6d3e14bd 100644 --- a/test/fixtures/output/flink/connection/create/create-missing-required-secret.golden +++ b/test/fixtures/output/flink/connection/create/create-missing-required-secret.golden @@ -17,8 +17,8 @@ Flags: --aws-secret-key string Specify secret key for the type: "bedrock" or "sagemaker". --aws-session-token string Specify session token for the type: "bedrock" or "sagemaker". --service-key string Specify service key for the type: "vertexai". - --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". - --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". + --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". + --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". --token string Specify bearer token for the type: "a2a", "rest", or "mcp_server". --token-endpoint string Specify OAuth2 token endpoint for the type: "a2a", "rest", or "mcp_server". --client-id string Specify OAuth2 client ID for the type: "a2a", "rest", or "mcp_server". diff --git a/test/fixtures/output/flink/connection/create/create-rest-missing-required-secret.golden b/test/fixtures/output/flink/connection/create/create-rest-missing-required-secret.golden index d5ac36441c..c4d6256598 100644 --- a/test/fixtures/output/flink/connection/create/create-rest-missing-required-secret.golden +++ b/test/fixtures/output/flink/connection/create/create-rest-missing-required-secret.golden @@ -17,8 +17,8 @@ Flags: --aws-secret-key string Specify secret key for the type: "bedrock" or "sagemaker". --aws-session-token string Specify session token for the type: "bedrock" or "sagemaker". --service-key string Specify service key for the type: "vertexai". - --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". - --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". + --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". + --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". --token string Specify bearer token for the type: "a2a", "rest", or "mcp_server". --token-endpoint string Specify OAuth2 token endpoint for the type: "a2a", "rest", or "mcp_server". --client-id string Specify OAuth2 client ID for the type: "a2a", "rest", or "mcp_server". diff --git a/test/fixtures/output/flink/connection/create/create-rest-mutually-exclusive-secret.golden b/test/fixtures/output/flink/connection/create/create-rest-mutually-exclusive-secret.golden index 7877c1560a..f34f6165c4 100644 --- a/test/fixtures/output/flink/connection/create/create-rest-mutually-exclusive-secret.golden +++ b/test/fixtures/output/flink/connection/create/create-rest-mutually-exclusive-secret.golden @@ -17,8 +17,8 @@ Flags: --aws-secret-key string Specify secret key for the type: "bedrock" or "sagemaker". --aws-session-token string Specify session token for the type: "bedrock" or "sagemaker". --service-key string Specify service key for the type: "vertexai". - --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". - --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". + --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". + --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". --token string Specify bearer token for the type: "a2a", "rest", or "mcp_server". --token-endpoint string Specify OAuth2 token endpoint for the type: "a2a", "rest", or "mcp_server". --client-id string Specify OAuth2 client ID for the type: "a2a", "rest", or "mcp_server". diff --git a/test/fixtures/output/flink/connection/update-help.golden b/test/fixtures/output/flink/connection/update-help.golden index 8b391e9c26..2d204baaa0 100644 --- a/test/fixtures/output/flink/connection/update-help.golden +++ b/test/fixtures/output/flink/connection/update-help.golden @@ -16,8 +16,8 @@ Flags: --aws-secret-key string Specify secret key for the type: "bedrock" or "sagemaker". --aws-session-token string Specify session token for the type: "bedrock" or "sagemaker". --service-key string Specify service key for the type: "vertexai". - --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". - --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", or "rest". + --username string Specify username for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". + --password string Specify password for the type: "mongodb", "couchbase", "confluent_jdbc", "a2a", "rest", or "mcp_server". --token string Specify bearer token for the type: "a2a", "rest", or "mcp_server". --token-endpoint string Specify OAuth2 token endpoint for the type: "a2a", "rest", or "mcp_server". --client-id string Specify OAuth2 client ID for the type: "a2a", "rest", or "mcp_server". diff --git a/test/flink_test.go b/test/flink_test.go index e5241f24b3..1601d87215 100644 --- a/test/flink_test.go +++ b/test/flink_test.go @@ -195,6 +195,7 @@ func (s *CLITestSuite) TestFlinkConnectionCreateSuccess() { {args: "flink connection create my-connection --cloud aws --region eu-west-1 --type mcp_server --endpoint https://api.example.com --api-key api_key --transport-type STREAMABLE_HTTP", fixture: "flink/connection/create/create-mcp_server.golden"}, {args: "flink connection create my-connection --cloud aws --region eu-west-1 --type mcp_server --endpoint https://api.example.com --token-endpoint https://api.example.com/auth --client-id clientId --client-secret secret --scope test_scope", fixture: "flink/connection/create/create-mcp_server.golden"}, {args: "flink connection create my-connection --cloud aws --region eu-west-1 --type mcp_server --endpoint https://api.example.com --token token --sse-endpoint /sse --transport-type SSE", fixture: "flink/connection/create/create-mcp_server.golden"}, + {args: "flink connection create my-connection --cloud aws --region eu-west-1 --type mcp_server --endpoint https://api.example.com --username name --password pass --transport-type SSE", fixture: "flink/connection/create/create-mcp_server.golden"}, } for _, test := range tests {