From 685d19dc6832d4f4e5d8da71c1d1a6c138707734 Mon Sep 17 00:00:00 2001 From: Cody Oss Date: Mon, 16 Dec 2024 09:44:55 -0600 Subject: [PATCH] feat: pass through logging in options This connects the logger passed in by users with options to the auth library. --- go.mod | 4 ++-- go.sum | 8 ++++---- idtoken/idtoken.go | 1 + internal/creds.go | 1 + transport/grpc/dial.go | 2 ++ transport/http/dial.go | 2 ++ 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 53b2de5ef7a..a64bdb9a22a 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,9 @@ module google.golang.org/api go 1.21 require ( - cloud.google.com/go/auth v0.12.1 + cloud.google.com/go/auth v0.13.0 cloud.google.com/go/auth/oauth2adapt v0.2.6 - cloud.google.com/go/compute/metadata v0.5.2 + cloud.google.com/go/compute/metadata v0.6.0 github.com/google/go-cmp v0.6.0 github.com/google/s2a-go v0.1.8 github.com/google/uuid v1.6.0 diff --git a/go.sum b/go.sum index 3c82d8ed3be..3ebea76c386 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,9 @@ -cloud.google.com/go/auth v0.12.1 h1:n2Bj25BUMM0nvE9D2XLTiImanwZhO3DkfWSYS/SAJP4= -cloud.google.com/go/auth v0.12.1/go.mod h1:BFMu+TNpF3DmvfBO9ClqTR/SiqVIm7LukKF9mbendF4= +cloud.google.com/go/auth v0.13.0 h1:8Fu8TZy167JkW8Tj3q7dIkr2v4cndv41ouecJx0PAHs= +cloud.google.com/go/auth v0.13.0/go.mod h1:COOjD9gwfKNKz+IIduatIhYJQIc0mG3H102r/EMxX6Q= cloud.google.com/go/auth/oauth2adapt v0.2.6 h1:V6a6XDu2lTwPZWOawrAa9HUK+DB2zfJyTuciBG5hFkU= cloud.google.com/go/auth/oauth2adapt v0.2.6/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8= -cloud.google.com/go/compute/metadata v0.5.2 h1:UxK4uu/Tn+I3p2dYWTfiX4wva7aYlKixAHn3fyqngqo= -cloud.google.com/go/compute/metadata v0.5.2/go.mod h1:C66sj2AluDcIqakBq/M8lw8/ybHgOZqin2obFxa/E5k= +cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= +cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= diff --git a/idtoken/idtoken.go b/idtoken/idtoken.go index 477164f904b..c8bf7c9b1f2 100644 --- a/idtoken/idtoken.go +++ b/idtoken/idtoken.go @@ -113,6 +113,7 @@ func newTokenSourceNewAuth(ctx context.Context, audience string, ds *internal.Di CredentialsFile: ds.CredentialsFile, CredentialsJSON: ds.CredentialsJSON, Client: oauth2.NewClient(ctx, nil), + Logger: ds.Logger, }) if err != nil { return nil, err diff --git a/internal/creds.go b/internal/creds.go index 4792b00c8b4..86861e24383 100644 --- a/internal/creds.go +++ b/internal/creds.go @@ -139,6 +139,7 @@ func detectDefaultFromDialSettings(settings *DialSettings) (*auth.Credentials, e CredentialsFile: settings.CredentialsFile, CredentialsJSON: settings.CredentialsJSON, UseSelfSignedJWT: useSelfSignedJWT, + Logger: settings.Logger, }) } diff --git a/transport/grpc/dial.go b/transport/grpc/dial.go index 95f4e7922d7..a354d223d31 100644 --- a/transport/grpc/dial.go +++ b/transport/grpc/dial.go @@ -235,6 +235,7 @@ func dialPoolNewAuth(ctx context.Context, secure bool, poolSize int, ds *interna Audience: aud, CredentialsFile: ds.CredentialsFile, CredentialsJSON: ds.CredentialsJSON, + Logger: ds.Logger, }, InternalOptions: &grpctransport.InternalOptions{ EnableNonDefaultSAForDirectPath: ds.AllowNonDefaultServiceAccount, @@ -248,6 +249,7 @@ func dialPoolNewAuth(ctx context.Context, secure bool, poolSize int, ds *interna SkipValidation: skipValidation, }, UniverseDomain: ds.UniverseDomain, + Logger: ds.Logger, }) return pool, err } diff --git a/transport/http/dial.go b/transport/http/dial.go index 6cdbac2ca1e..6b7ea74ba41 100644 --- a/transport/http/dial.go +++ b/transport/http/dial.go @@ -119,6 +119,7 @@ func newClientNewAuth(ctx context.Context, base http.RoundTripper, ds *internal. Audience: aud, CredentialsFile: ds.CredentialsFile, CredentialsJSON: ds.CredentialsJSON, + Logger: ds.Logger, }, InternalOptions: &httptransport.InternalOptions{ EnableJWTWithScope: ds.EnableJwtWithScope, @@ -129,6 +130,7 @@ func newClientNewAuth(ctx context.Context, base http.RoundTripper, ds *internal. SkipValidation: skipValidation, }, UniverseDomain: ds.UniverseDomain, + Logger: ds.Logger, }) if err != nil { return nil, err