Skip to content

Commit

Permalink
Removed explicit token fetch
Browse files Browse the repository at this point in the history
Signed-off-by: mabhi <[email protected]>
  • Loading branch information
mabhi committed Oct 15, 2023
1 parent 9da7aa0 commit 26c3ebd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
14 changes: 0 additions & 14 deletions pkg/blockstorage/azure/auth.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package azure

import (
"context"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/kanisterio/kanister/pkg/blockstorage"
"github.com/pkg/errors"
Expand Down Expand Up @@ -95,10 +93,6 @@ func (d *DefaultAuthenticator) Authenticate(creds map[string]string) error {
if err != nil {
return errors.Wrap(err, "Failed to create an Azure Default Identity credential")
}
_, err = cred.GetToken(context.Background(), policy.TokenRequestOptions{})
if err != nil {
return errors.Wrap(err, "Failed to create an access token")
}
d.TokenCredential = cred
// creds passed authentication
return nil
Expand All @@ -125,10 +119,6 @@ func (m *MsiAuthenticator) Authenticate(creds map[string]string) error {
if err != nil {
return errors.Wrap(err, "Failed to create an Azure Managed Identity credential")
}
_, err = cred.GetToken(context.Background(), policy.TokenRequestOptions{})
if err != nil {
return errors.Wrap(err, "Failed to create an access token")
}
m.TokenCredential = cred
// creds passed authentication
return nil
Expand All @@ -151,10 +141,6 @@ func (c *ClientSecretAuthenticator) Authenticate(creds map[string]string) error
if err != nil {
return errors.Wrap(err, "Failed to create an Azure Client Secret credential")
}
_, err = cred.GetToken(context.Background(), policy.TokenRequestOptions{})
if err != nil {
return errors.Wrap(err, "Failed to create an access token")
}
c.TokenCredential = cred
// creds passed authentication
return nil
Expand Down
1 change: 1 addition & 0 deletions pkg/blockstorage/helper_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package blockstorage

0 comments on commit 26c3ebd

Please sign in to comment.