-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(storage): find GoogleAccessID when using impersonated creds #6591
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good, a few comments on docs clarity and factoring. We should also update the docs for SignedURL and PostPolicyV4 options; they still note that "at least one of PrivateKey and SignedBytes must be non-nil" which is not accurate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple more docs nits, but overall looks good
FWIW: I was impacted by this issue, and as a workaround, I currently have to do the following:
serviceAccount = json.Unmarshal(os.Getenv("GOOGLE_CREDENTIALS"))
res, err := client.Bucket(bucket).SignedURL(path, &gstorage.SignedURLOptions{
Scheme: gstorage.SigningSchemeV4,
Method: "PUT",
GoogleAccessID: serviceAccount.ClientEmail,
PrivateKey: []byte(serviceAccount.PrivateKey),
Expires: time.Now().Add(15 * time.Minute),
}) I just tested using this PR, by adding the following in
And changing my code to:
And I'm glad to report that this works as before 👍 🥳 🍻 Thank you @BrennaEpp and can't wait for this to get merged and released 🤞 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Brenna!
🤖 I have created a release *beep* *boop* --- ## [1.27.0](storage/v1.26.0...storage/v1.27.0) (2022-09-22) ### Features * **storage:** Find GoogleAccessID when using impersonated creds ([#6591](#6591)) ([a2d16a7](a2d16a7)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
bucket.SignedURL
andbucket.GenerateSignedPostPolicyV4
now automatically detect the GoogleAccessID when using impersonated credentials, i.e. when authenticated viagcloud auth application-default login --impersonate-service-account ${SERVICE_ACCOUNT}
This prevents users from having to manage a private key or pass in the service account to these methods in their code; see #5979