Remove username/password credential handling from newConfigCredential (#9041)
Some checks failed
Run the E2E test on kind / build (push) Failing after 6m56s
Run the E2E test on kind / setup-test-matrix (push) Successful in 4s
Run the E2E test on kind / run-e2e-test (push) Has been skipped
Main CI / Build (push) Failing after 1m1s
Close stale issues and PRs / stale (push) Successful in 16s
Trivy Nightly Scan / Trivy nightly scan (velero, main) (push) Failing after 1m30s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-aws, main) (push) Failing after 1m17s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-gcp, main) (push) Failing after 1m18s
Trivy Nightly Scan / Trivy nightly scan (velero-plugin-for-microsoft-azure, main) (push) Failing after 1m15s

* remove username/password credential handling from newConfigCredential

Signed-off-by: Priyansh Choudhary <im1706@gmail.com>

* changelog update
Signed-off-by: Priyansh Choudhary <im1706@gmail.com>

* remove username/password credential tests from newConfigCredential.
Signed-off-by: Priyansh Choudhary <im1706@gmail.com>

---------

Signed-off-by: Priyansh Choudhary <im1706@gmail.com>
This commit is contained in:
Priyansh Choudhary
2025-06-27 19:32:41 +05:30
committed by GitHub
parent bd09744b2d
commit bd609db395
3 changed files with 1 additions and 25 deletions

View File

@@ -0,0 +1 @@
Removed username/password credential handling from newConfigCredential as azidentity.UsernamePasswordCredentialOptions is reported as deprecated.

View File

@@ -113,17 +113,5 @@ func newConfigCredential(creds map[string]string, options configCredentialOption
return azidentity.NewClientCertificateCredential(tenantID, clientID, certs, key, o)
}
// username/password
if username := creds[CredentialKeyUsername]; username != "" {
if password := creds[CredentialKeyPassword]; password != "" {
return azidentity.NewUsernamePasswordCredential(tenantID, clientID, username, password,
&azidentity.UsernamePasswordCredentialOptions{ //nolint:staticcheck // will be solved by https://github.com/vmware-tanzu/velero/issues/9028
AdditionallyAllowedTenants: options.AdditionallyAllowedTenants,
ClientOptions: options.ClientOptions,
})
}
return nil, errors.Errorf("%s is required", CredentialKeyPassword)
}
return nil, errors.New("incomplete credential configuration. Only AZURE_TENANT_ID and AZURE_CLIENT_ID are set")
}

View File

@@ -116,19 +116,6 @@ func Test_newConfigCredential(t *testing.T) {
require.NotNil(t, credential)
_, ok = credential.(*azidentity.ClientCertificateCredential)
require.True(t, ok)
// username/password
creds = map[string]string{
CredentialKeyTenantID: "clientid",
CredentialKeyClientID: "clientid",
CredentialKeyUsername: "username",
CredentialKeyPassword: "password",
}
credential, err = newConfigCredential(creds, options)
require.NoError(t, err)
require.NotNil(t, credential)
_, ok = credential.(*azidentity.UsernamePasswordCredential)
require.True(t, ok)
}
func readCertData() (string, error) {