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:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user