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

feat(auth): add UniverseDomain to DetectOptions #9536

Merged
merged 22 commits into from
Mar 20, 2024

Conversation

quartzmo
Copy link
Member

@quartzmo quartzmo commented Mar 8, 2024

Depends on #9603

@quartzmo quartzmo requested a review from a team as a code owner March 8, 2024 23:32
@quartzmo quartzmo marked this pull request as draft March 13, 2024 20:49
auth/detect/detect.go Outdated Show resolved Hide resolved
auth/detect/compute.go Outdated Show resolved Hide resolved
auth/grpctransport/grpctransport.go Show resolved Hide resolved
auth/grpctransport/grpctransport.go Outdated Show resolved Hide resolved
@quartzmo quartzmo changed the title feat(auth): add UniverseDomain to detect.Options feat(auth): add UniverseDomain to DetectOptions Mar 18, 2024
@quartzmo quartzmo marked this pull request as ready for review March 19, 2024 23:09
Copy link
Member

@codyoss codyoss left a comment

Choose a reason for hiding this comment

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

Mostly just nits, nice work!

auth/credentials/filetypes.go Outdated Show resolved Hide resolved
@@ -93,6 +93,7 @@ func DetectDefault(opts *DetectOptions) (*auth.Credentials, error) {
ProjectIDProvider: auth.CredentialsPropertyFunc(func(context.Context) (string, error) {
return metadata.ProjectID()
}),
UniverseDomainProvider: &internal.ComputeUniverseDomainProvider{},
Copy link
Member

Choose a reason for hiding this comment

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

nit: maybe the struct returned by the computeTokenProvider method could have a method that impl's this and/or return a function to impl it. Then all the compute logic is tied to a single struct.

Copy link
Member

Choose a reason for hiding this comment

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

after reviewing a bit more maybe this is fine as it is used in more than one spot, I will leave the comment open though for your consideration.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, let's leave as-is.

base: base,
creds: creds,
base: base,
// TODO(quartzmo): Somehow set clientUniverseDomain from impersonate calls.
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this to take an optional third arg, or what are your thoughts here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure how this should be done. If you can suggest the change, let's do it in this PR. Otherwise, we could wait.

// httpGetMetadataUniverseDomain is a package var for unit test substitution.
var httpGetMetadataUniverseDomain = func(ctx context.Context) (string, error) {
client := metadata.NewClient(&http.Client{Timeout: time.Second})
// TODO(quartzmo): set ctx on request
Copy link
Member

Choose a reason for hiding this comment

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

I would really like if we updated the surface of the metadata package to be context aware in the future.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, let's do it soon.

auth/internal/transport/transport.go Outdated Show resolved Hide resolved
@quartzmo quartzmo merged commit 3618d3f into googleapis:main Mar 20, 2024
9 checks passed
@quartzmo quartzmo deleted the auth-universe-domain-2 branch March 20, 2024 20:01
gcf-merge-on-green bot pushed a commit that referenced this pull request Apr 15, 2024
🤖 I have created a release *beep* *boop*
---


## [0.2.0](https://togithub.com/googleapis/google-cloud-go/compare/auth/v0.1.1...auth/v0.2.0) (2024-04-15)


### Features

* **auth/credentials/externalaccount:** Add default TokenURL ([#9700](https://togithub.com/googleapis/google-cloud-go/issues/9700)) ([81830e6](https://togithub.com/googleapis/google-cloud-go/commit/81830e6848ceefd055aa4d08f933d1154455a0f6))
* **auth:** Add downscope.Options.UniverseDomain ([#9634](https://togithub.com/googleapis/google-cloud-go/issues/9634)) ([52cf7d7](https://togithub.com/googleapis/google-cloud-go/commit/52cf7d780853594291c4e34302d618299d1f5a1d))
* **auth:** Add universe domain to grpctransport and httptransport ([#9663](https://togithub.com/googleapis/google-cloud-go/issues/9663)) ([67d353b](https://togithub.com/googleapis/google-cloud-go/commit/67d353beefe3b607c08c891876fbd95ab89e5fe3)), refs [#9670](https://togithub.com/googleapis/google-cloud-go/issues/9670)
* **auth:** Add UniverseDomain to DetectOptions ([#9536](https://togithub.com/googleapis/google-cloud-go/issues/9536)) ([3618d3f](https://togithub.com/googleapis/google-cloud-go/commit/3618d3f7061615c0e189f376c75abc201203b501))
* **auth:** Make package externalaccount public ([#9633](https://togithub.com/googleapis/google-cloud-go/issues/9633)) ([a0978d8](https://togithub.com/googleapis/google-cloud-go/commit/a0978d8e96968399940ebd7d092539772bf9caac))
* **auth:** Move credentials to base auth package ([#9590](https://togithub.com/googleapis/google-cloud-go/issues/9590)) ([1a04baf](https://togithub.com/googleapis/google-cloud-go/commit/1a04bafa83c27342b9308d785645e1e5423ea10d))
* **auth:** Refactor public sigs to use Credentials ([#9603](https://togithub.com/googleapis/google-cloud-go/issues/9603)) ([69cb240](https://togithub.com/googleapis/google-cloud-go/commit/69cb240c530b1f7173a9af2555c19e9a1beb56c5))


### Bug Fixes

* **auth/oauth2adapt:** Update protobuf dep to v1.33.0 ([30b038d](https://togithub.com/googleapis/google-cloud-go/commit/30b038d8cac0b8cd5dd4761c87f3f298760dd33a))
* **auth:** Fix uint32 conversion ([9221c7f](https://togithub.com/googleapis/google-cloud-go/commit/9221c7fa12cef9d5fb7ddc92f41f1d6204971c7b))
* **auth:** Port sts expires fix ([#9618](https://togithub.com/googleapis/google-cloud-go/issues/9618)) ([7bec97b](https://togithub.com/googleapis/google-cloud-go/commit/7bec97b2f51ed3ac4f9b88bf100d301da3f5d1bd))
* **auth:** Read universe_domain from all credentials files ([#9632](https://togithub.com/googleapis/google-cloud-go/issues/9632)) ([16efbb5](https://togithub.com/googleapis/google-cloud-go/commit/16efbb52e39ea4a319e5ee1e95c0e0305b6d9824))
* **auth:** Remove content-type header from idms get requests ([#9508](https://togithub.com/googleapis/google-cloud-go/issues/9508)) ([8589f41](https://togithub.com/googleapis/google-cloud-go/commit/8589f41599d265d7c3d46a3d86c9fab2329cbdd9))
* **auth:** Update protobuf dep to v1.33.0 ([30b038d](https://togithub.com/googleapis/google-cloud-go/commit/30b038d8cac0b8cd5dd4761c87f3f298760dd33a))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants