Skip to content

Commit

Permalink
fix(storage): add universe domain to defaultSignBytesFunc (#11521)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrennaEpp authored Feb 4, 2025
1 parent 678944b commit 511608b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion storage/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,19 @@ func (b *BucketHandle) defaultSignBytesFunc(email string) func([]byte) ([]byte,
return func(in []byte) ([]byte, error) {
ctx := context.Background()

opts := []option.ClientOption{option.WithHTTPClient(b.c.hc)}

if b.c.creds != nil {
universeDomain, err := b.c.creds.GetUniverseDomain()
if err != nil {
return nil, err
}
opts = append(opts, option.WithUniverseDomain(universeDomain))
}

// It's ok to recreate this service per call since we pass in the http client,
// circumventing the cost of recreating the auth/transport layer
svc, err := iamcredentials.NewService(ctx, option.WithHTTPClient(b.c.hc))
svc, err := iamcredentials.NewService(ctx, opts...)
if err != nil {
return nil, fmt.Errorf("unable to create iamcredentials client: %w", err)
}
Expand Down

0 comments on commit 511608b

Please sign in to comment.