diff --git a/v5/core/authenticator_factory.go b/v5/core/authenticator_factory.go index b434906c..5b7e9b03 100644 --- a/v5/core/authenticator_factory.go +++ b/v5/core/authenticator_factory.go @@ -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] != "" { diff --git a/v5/core/config_utils_test.go b/v5/core/config_utils_test.go index 448a202e..9cac708c 100644 --- a/v5/core/config_utils_test.go +++ b/v5/core/config_utils_test.go @@ -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]) @@ -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]) diff --git a/v5/resources/my-credentials.env b/v5/resources/my-credentials.env index 94c0c0b5..f9b73571 100644 --- a/v5/resources/my-credentials.env +++ b/v5/resources/my-credentials.env @@ -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