Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storage): migrate oauth2/google usages to cloud.google.com/go/auth #11191

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

quartzmo
Copy link
Member

No description provided.

@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Nov 25, 2024
quartzmo added a commit to quartzmo/google-api-go-client that referenced this pull request Nov 26, 2024
quartzmo added a commit to quartzmo/google-api-go-client that referenced this pull request Nov 26, 2024
quartzmo added a commit to googleapis/google-api-go-client that referenced this pull request Nov 26, 2024
Copy link
Contributor

@BrennaEpp BrennaEpp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general looks good, thank you for the changes. Just a note on making sure tests pass with old auth creds sent in by users.

Comment on lines +128 to +132
func (c Client) credsJSON() []byte {
if c.creds != nil && len(c.creds.JSON()) > 0 {
return c.creds.JSON()
}
return []byte{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be nicer returning the creds and a bool so that callers can check creds, ok := credsJSON()

Suggested change
func (c Client) credsJSON() []byte {
if c.creds != nil && len(c.creds.JSON()) > 0 {
return c.creds.JSON()
}
return []byte{}
func (c Client) credsJSON() ([]byte, bool) {
if c.creds != nil && len(c.creds.JSON()) > 0 {
return c.creds.JSON(), true
}
return []byte{}, false

@@ -5728,7 +5751,7 @@ func TestIntegration_PostPolicyV4_WithCreds(t *testing.T) {
}
})
}
}, option.WithCredentials(creds))
}, option.WithAuthCredentials(creds))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try running the integration tests without changes? I would like to make sure they pass even using the old auth before switching them over.

Signed URL stuff in particular, do you think it would be useful to test with both the old and new auth paths?

Comment on lines +1295 to +1297
creds, err := credentials.DetectDefault(&credentials.DetectOptions{
CredentialsJSON: jsonBytes,
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to get auth credentials here without this function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants