Skip to content

Commit

Permalink
update credentials to use azcore bearer policy
Browse files Browse the repository at this point in the history
  • Loading branch information
catalinaperalta committed Jun 23, 2021
1 parent 6c64de6 commit 0050a19
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 122 deletions.
2 changes: 1 addition & 1 deletion sdk/azidentity/authorization_code_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (c *AuthorizationCodeCredential) GetToken(ctx context.Context, opts azcore.

// AuthenticationPolicy implements the azcore.Credential interface on AuthorizationCodeCredential.
func (c *AuthorizationCodeCredential) AuthenticationPolicy(options azcore.AuthenticationPolicyOptions) azcore.Policy {
return newBearerTokenPolicy(c, options)
return azcore.NewBearerTokenPolicy(c, options)
}

var _ azcore.TokenCredential = (*AuthorizationCodeCredential)(nil)
2 changes: 1 addition & 1 deletion sdk/azidentity/azure_cli_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *AzureCLICredential) GetToken(ctx context.Context, opts azcore.TokenRequ

// AuthenticationPolicy implements the azcore.Credential interface on AzureCLICredential.
func (c *AzureCLICredential) AuthenticationPolicy(options azcore.AuthenticationPolicyOptions) azcore.Policy {
return newBearerTokenPolicy(c, options)
return azcore.NewBearerTokenPolicy(c, options)
}

const timeoutCLIRequest = 10000 * time.Millisecond
Expand Down
112 changes: 0 additions & 112 deletions sdk/azidentity/bearer_token_policy.go

This file was deleted.

2 changes: 1 addition & 1 deletion sdk/azidentity/chained_token_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *ChainedTokenCredential) GetToken(ctx context.Context, opts azcore.Token

// AuthenticationPolicy implements the azcore.Credential interface on ChainedTokenCredential and sets the bearer token
func (c *ChainedTokenCredential) AuthenticationPolicy(options azcore.AuthenticationPolicyOptions) azcore.Policy {
return newBearerTokenPolicy(c, options)
return azcore.NewBearerTokenPolicy(c, options)
}

// helper function used to chain the error messages of the CredentialUnavailableError slice
Expand Down
2 changes: 1 addition & 1 deletion sdk/azidentity/client_certificate_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,5 @@ func (c *ClientCertificateCredential) GetToken(ctx context.Context, opts azcore.

// AuthenticationPolicy implements the azcore.Credential interface on ClientCertificateCredential.
func (c *ClientCertificateCredential) AuthenticationPolicy(options azcore.AuthenticationPolicyOptions) azcore.Policy {
return newBearerTokenPolicy(c, options)
return azcore.NewBearerTokenPolicy(c, options)
}
2 changes: 1 addition & 1 deletion sdk/azidentity/client_secret_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (c *ClientSecretCredential) GetToken(ctx context.Context, opts azcore.Token
// AuthenticationPolicy implements the azcore.Credential interface on ClientSecretCredential and calls the Bearer Token policy
// to get the bearer token.
func (c *ClientSecretCredential) AuthenticationPolicy(options azcore.AuthenticationPolicyOptions) azcore.Policy {
return newBearerTokenPolicy(c, options)
return azcore.NewBearerTokenPolicy(c, options)
}

var _ azcore.TokenCredential = (*ClientSecretCredential)(nil)
2 changes: 1 addition & 1 deletion sdk/azidentity/device_code_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (c *DeviceCodeCredential) GetToken(ctx context.Context, opts azcore.TokenRe

// AuthenticationPolicy implements the azcore.Credential interface on DeviceCodeCredential.
func (c *DeviceCodeCredential) AuthenticationPolicy(options azcore.AuthenticationPolicyOptions) azcore.Policy {
return newBearerTokenPolicy(c, options)
return azcore.NewBearerTokenPolicy(c, options)
}

// deviceCodeResult is used to store device code related information to help the user login and allow the device code flow to continue
Expand Down
2 changes: 1 addition & 1 deletion sdk/azidentity/environment_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (c *EnvironmentCredential) GetToken(ctx context.Context, opts azcore.TokenR

// AuthenticationPolicy implements the azcore.Credential interface on EnvironmentCredential.
func (c *EnvironmentCredential) AuthenticationPolicy(options azcore.AuthenticationPolicyOptions) azcore.Policy {
return newBearerTokenPolicy(c.cred, options)
return azcore.NewBearerTokenPolicy(c.cred, options)
}

var _ azcore.TokenCredential = (*EnvironmentCredential)(nil)
2 changes: 1 addition & 1 deletion sdk/azidentity/interactive_browser_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (c *InteractiveBrowserCredential) GetToken(ctx context.Context, opts azcore

// AuthenticationPolicy implements the azcore.Credential interface on InteractiveBrowserCredential.
func (c *InteractiveBrowserCredential) AuthenticationPolicy(options azcore.AuthenticationPolicyOptions) azcore.Policy {
return newBearerTokenPolicy(c, options)
return azcore.NewBearerTokenPolicy(c, options)
}

var _ azcore.TokenCredential = (*InteractiveBrowserCredential)(nil)
Expand Down
2 changes: 1 addition & 1 deletion sdk/azidentity/managed_identity_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,5 @@ func (c *ManagedIdentityCredential) GetToken(ctx context.Context, opts azcore.To
// AuthenticationPolicy implements the azcore.Credential interface on ManagedIdentityCredential.
// NOTE: The TokenRequestOptions included in AuthenticationPolicyOptions must be a slice of resources in this case and not scopes.
func (c *ManagedIdentityCredential) AuthenticationPolicy(options azcore.AuthenticationPolicyOptions) azcore.Policy {
return newBearerTokenPolicy(c, options)
return azcore.NewBearerTokenPolicy(c, options)
}
2 changes: 1 addition & 1 deletion sdk/azidentity/username_password_credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ func (c *UsernamePasswordCredential) GetToken(ctx context.Context, opts azcore.T

// AuthenticationPolicy implements the azcore.Credential interface on UsernamePasswordCredential.
func (c *UsernamePasswordCredential) AuthenticationPolicy(options azcore.AuthenticationPolicyOptions) azcore.Policy {
return newBearerTokenPolicy(c, options)
return azcore.NewBearerTokenPolicy(c, options)
}

0 comments on commit 0050a19

Please sign in to comment.