Skip to content

Commit

Permalink
Fix client auth in policy resources
Browse files Browse the repository at this point in the history
Following SDK change that validates http security context to
contain auth type, we need to avoid setting http security context
when TLS client auth is responsible for authentication.
  • Loading branch information
annakhm committed Apr 17, 2020
1 parent f6ac058 commit 56495e4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nsxt/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,9 @@ func configurePolicyConnectorData(d *schema.ResourceData, clients *nsxtClients)

httpClient := http.Client{Transport: tr}
clients.PolicyHTTPClient = &httpClient
clients.PolicySecurityContext = securityCtx
if securityContextNeeded {
clients.PolicySecurityContext = securityCtx
}
clients.Host = host

return nil
Expand All @@ -534,6 +536,8 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
func getPolicyConnector(clients interface{}) *client.RestConnector {
c := clients.(nsxtClients)
connector := client.NewRestConnector(c.Host, *c.PolicyHTTPClient)
connector.SetSecurityContext(c.PolicySecurityContext)
if c.PolicySecurityContext != nil {
connector.SetSecurityContext(c.PolicySecurityContext)
}
return connector
}

0 comments on commit 56495e4

Please sign in to comment.