Support HTTP Basic auth in API-key connections

Cursor's Admin API authenticates with the admin key as the HTTP
Basic auth username (empty password) and rejects Bearer tokens.
The API-key connection previously supported only Bearer and a
custom header (Anthropic's x-api-key); add a Basic-auth mode
selected by Registration.APIKeyBasicAuth, and reject providers
that set both it and APIKeyHeader.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-05-28 23:44:28 +02:00
parent 72c35a9967
commit 0149ca4f55
6 changed files with 179 additions and 2 deletions

View File

@@ -81,6 +81,20 @@ func TestRegistry_Register(t *testing.T) {
assert.Contains(t, err.Error(), "missing DisplayName")
})
t.Run("APIKeyBasicAuth and APIKeyHeader mutually exclusive", func(t *testing.T) {
t.Parallel()
r := provider.NewRegistry()
err := r.Register(&provider.Registration{
Provider: coredata.ConnectorProviderSlack,
DisplayName: "Slack",
APIKeyBasicAuth: true,
APIKeyHeader: "x-api-key",
})
require.Error(t, err)
assert.Contains(t, err.Error(), "mutually exclusive")
})
t.Run("duplicate registration", func(t *testing.T) {
t.Parallel()