Skip to content

Commit

Permalink
google: use Credentials instead of deprecated DefaultCredentials
Browse files Browse the repository at this point in the history
Change-Id: Ie2d972df025f6b6b7d172015aae7eb34e355cb28
Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/412034
Reviewed-by: Matt Hickford <matt.hickford@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cody Oss <codyoss@google.com>
Reviewed-by: Matthew Hickford <hickford@google.com>
Run-TryBot: Matt Hickford <matt.hickford@gmail.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cody Oss <codyoss@google.com>
  • Loading branch information
zchee authored and gopherbot committed Feb 27, 2023
1 parent c82d0e1 commit 6f9c1a1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions google/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func FindDefaultCredentialsWithParams(ctx context.Context, params CredentialsPar
// use those credentials. App Engine standard second generation runtimes (>= Go 1.11)
// and App Engine flexible use ComputeTokenSource and the metadata server.
if appengineTokenFunc != nil {
return &DefaultCredentials{
return &Credentials{
ProjectID: appengineAppIDFunc(ctx),
TokenSource: AppEngineTokenSource(ctx, params.Scopes...),
}, nil
Expand All @@ -147,7 +147,7 @@ func FindDefaultCredentialsWithParams(ctx context.Context, params CredentialsPar
// or App Engine flexible, use the metadata server.
if metadata.OnGCE() {
id, _ := metadata.ProjectID()
return &DefaultCredentials{
return &Credentials{
ProjectID: id,
TokenSource: ComputeTokenSource("", params.Scopes...),
}, nil
Expand Down Expand Up @@ -194,7 +194,7 @@ func CredentialsFromJSONWithParams(ctx context.Context, jsonData []byte, params
return nil, err
}
ts = newErrWrappingTokenSource(ts)
return &DefaultCredentials{
return &Credentials{
ProjectID: f.ProjectID,
TokenSource: ts,
JSON: jsonData,
Expand All @@ -216,7 +216,7 @@ func wellKnownFile() string {
return filepath.Join(guessUnixHomeDir(), ".config", "gcloud", f)
}

func readCredentialsFile(ctx context.Context, filename string, params CredentialsParams) (*DefaultCredentials, error) {
func readCredentialsFile(ctx context.Context, filename string, params CredentialsParams) (*Credentials, error) {
b, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
Expand Down

0 comments on commit 6f9c1a1

Please sign in to comment.