Skip to content

Commit

Permalink
AutoRest: ensuring the same senders are used for auth & client reques…
Browse files Browse the repository at this point in the history
…ts (#3301)

* dependencies: upgrading to v0.4.0 of github.com/hashicorp/go-azure-helpers

* setting the proxy for the auth request
  • Loading branch information
tombuildsstuff authored and katbyte committed Apr 25, 2019
1 parent 2b79f9e commit 645ce9c
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 16 deletions.
9 changes: 5 additions & 4 deletions azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,24 +455,25 @@ func getArmClient(c *authentication.Config, skipProviderRegistration bool, partn
return nil, fmt.Errorf("Unable to configure OAuthConfig for tenant %s", c.TenantID)
}

sender := azure.BuildSender()

// Resource Manager endpoints
endpoint := env.ResourceManagerEndpoint
auth, err := c.GetAuthorizationToken(oauthConfig, env.TokenAudience)
auth, err := c.GetAuthorizationToken(sender, oauthConfig, env.TokenAudience)
if err != nil {
return nil, err
}

// Graph Endpoints
graphEndpoint := env.GraphEndpoint
graphAuth, err := c.GetAuthorizationToken(oauthConfig, graphEndpoint)
graphAuth, err := c.GetAuthorizationToken(sender, oauthConfig, graphEndpoint)
if err != nil {
return nil, err
}

// Key Vault Endpoints
sender := azure.BuildSender()
keyVaultAuth := autorest.NewBearerAuthorizerCallback(sender, func(tenantID, resource string) (*autorest.BearerAuthorizer, error) {
keyVaultSpt, err := c.GetAuthorizationToken(oauthConfig, resource)
keyVaultSpt, err := c.GetAuthorizationToken(sender, oauthConfig, resource)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/golang/mock v1.2.0 // indirect
github.com/google/uuid v0.0.0-20170814143639-7e072fc3a7be
github.com/grpc-ecosystem/grpc-gateway v1.6.3 // indirect
github.com/hashicorp/go-azure-helpers v0.0.0-20181211121309-38db96513363
github.com/hashicorp/go-azure-helpers v0.4.0
github.com/hashicorp/go-getter v0.0.0-20180327010114-90bb99a48d86
github.com/hashicorp/go-hclog v0.0.0-20170903163258-8105cc0a3736 // indirect
github.com/hashicorp/go-multierror v1.0.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/U
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-azure-helpers v0.0.0-20181211121309-38db96513363 h1:9d0jVlMpgfMTdL/QSsRDQsLenOQZIHp5cEBiWSYc8w4=
github.com/hashicorp/go-azure-helpers v0.0.0-20181211121309-38db96513363/go.mod h1:Y5ejHZY3jQby82dOASJzyQ2xZw37zs+D5x6AaOC6O5E=
github.com/hashicorp/go-azure-helpers v0.4.0 h1:iAJWTrKSD002iu5g33TgKeHK1NNqmafQftPC+yx+Hgk=
github.com/hashicorp/go-azure-helpers v0.4.0/go.mod h1:lu62V//auUow6k0IykxLK2DCNW8qTmpm8KqhYVWattA=
github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de h1:XDCSythtg8aWSRSO29uwhgh7b127fWr+m5SemqjSUL8=
github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de/go.mod h1:xIwEieBHERyEvaeKF/TcHh1Hu+lxPM+n2vT1+g9I4m4=
github.com/hashicorp/go-cleanhttp v0.0.0-20170211013415-3573b8b52aa7 h1:67fHcS+inUoiIqWCKIqeDuq2AlPHNHPiTqp97LdQ+bc=
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ github.com/golang/protobuf/ptypes/duration
github.com/google/uuid
# github.com/hashicorp/errwrap v1.0.0
github.com/hashicorp/errwrap
# github.com/hashicorp/go-azure-helpers v0.0.0-20181211121309-38db96513363
# github.com/hashicorp/go-azure-helpers v0.4.0
github.com/hashicorp/go-azure-helpers/authentication
github.com/hashicorp/go-azure-helpers/resourceproviders
github.com/hashicorp/go-azure-helpers/storage
Expand Down

0 comments on commit 645ce9c

Please sign in to comment.