config: support multiple destination addresses (#1789)

* config: support multiple destination addresses

* use constructor for string slice

* add docs

* add test for multiple destinations

* fix name
This commit is contained in:
Caleb Doxsey 2021-01-20 15:18:24 -07:00 committed by GitHub
parent c6b6141d12
commit a4c7381eba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 556 additions and 191 deletions

View file

@ -133,7 +133,11 @@ func (a *Authorize) getGoogleCloudServerlessAuthenticationHeaders(reply *evaluat
}
serviceAccount := a.currentOptions.Load().GoogleCloudServerlessAuthenticationServiceAccount
audience := fmt.Sprintf("https://%s", reply.MatchingPolicy.Destination.Hostname())
var hostname string
if len(reply.MatchingPolicy.Destinations) > 0 {
hostname = reply.MatchingPolicy.Destinations[0].Hostname()
}
audience := fmt.Sprintf("https://%s", hostname)
src, err := getGoogleCloudServerlessTokenSource(serviceAccount, audience)
if err != nil {