Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions v5/core/authenticator_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ func GetAuthenticatorFromEnvironment(credentialKey string) (authenticator Authen

// Determine the authentication type if not specified explicitly.
authType := properties[PROPNAME_AUTH_TYPE]

// Support alternate "AUTHTYPE" property.
if authType == "" {
authType = properties["AUTHTYPE"]
}

// Determine a default auth type if one wasn't specified.
if authType == "" {
// If the APIKEY property is specified, then we'll guess IAM... otherwise CR Auth.
if properties[PROPNAME_APIKEY] != "" {
Expand Down
4 changes: 2 additions & 2 deletions v5/core/config_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestGetServicePropertiesFromCredentialFile(t *testing.T) {
assert.Equal(t, "https://service2/api", props[PROPNAME_SVC_URL])
assert.Equal(t, "false", props[PROPNAME_SVC_DISABLE_SSL])
assert.Equal(t, "false", props[PROPNAME_SVC_ENABLE_GZIP])
assert.Equal(t, strings.ToUpper(AUTHTYPE_BASIC), strings.ToUpper(props[PROPNAME_AUTH_TYPE]))
assert.Equal(t, strings.ToUpper(AUTHTYPE_BASIC), strings.ToUpper(props["AUTHTYPE"]))
assert.Equal(t, "my-user", props[PROPNAME_USERNAME])
assert.Equal(t, "my-password", props[PROPNAME_PASSWORD])

Expand All @@ -85,7 +85,7 @@ func TestGetServicePropertiesFromCredentialFile(t *testing.T) {
assert.Equal(t, "https://service3/api", props[PROPNAME_SVC_URL])
assert.Equal(t, "false", props[PROPNAME_SVC_DISABLE_SSL])
assert.Equal(t, "notabool", props[PROPNAME_SVC_ENABLE_GZIP])
assert.Equal(t, strings.ToUpper(AUTHTYPE_CP4D), strings.ToUpper(props[PROPNAME_AUTH_TYPE]))
assert.Equal(t, strings.ToUpper(AUTHTYPE_CP4D), strings.ToUpper(props["AUTHTYPE"]))
assert.Equal(t, "my-cp4d-user", props[PROPNAME_USERNAME])
assert.Equal(t, "my-cp4d-password", props[PROPNAME_PASSWORD])
assert.Equal(t, "https://cp4dhost/cp4d/api", props[PROPNAME_AUTH_URL])
Expand Down
4 changes: 2 additions & 2 deletions v5/resources/my-credentials.env
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ SERVICE_1_AUTH_URL=https://iamhost/iam/api
SERVICE_1_AUTH_DISABLE_SSL=true

# Service2 configured with Basic Auth
SERVICE2_AUTH_TYPE=BasiC
SERVICE2_AUTHTYPE=BasiC
SERVICE2_USERNAME=my-user
SERVICE2_PASSWORD=my-password

# Service3 configured with CP4D
SERVICE3_AUTH_TYPE=CP4d
SERVICE3_AUTHTYPE=CP4d
SERVICE3_AUTH_URL=https://cp4dhost/cp4d/api
SERVICE3_USERNAME=my-cp4d-user
SERVICE3_PASSWORD=my-cp4d-password
Expand Down