Add SSWS API-key Authorization scheme
Okta API tokens authenticate as "Authorization: SSWS <token>", a scheme none of the existing API-key modes (Bearer, custom header, Basic) can express. Add Registration.APIKeyAuthScheme, plumb it onto APIKeyConnection.Scheme, and send it via a new schemeAuthTransport. The three API-key presentations (BasicAuth, Header, Scheme) are mutually exclusive; Register rejects setting more than one so a misconfiguration fails at process start rather than silently. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -95,6 +95,20 @@ func TestRegistry_Register(t *testing.T) {
|
||||
assert.Contains(t, err.Error(), "mutually exclusive")
|
||||
})
|
||||
|
||||
t.Run("APIKeyAuthScheme and APIKeyHeader mutually exclusive", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
r := provider.NewRegistry()
|
||||
err := r.Register(&provider.Registration{
|
||||
Provider: coredata.ConnectorProviderSlack,
|
||||
DisplayName: "Slack",
|
||||
APIKeyAuthScheme: "SSWS",
|
||||
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