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 universe domain support to credentials/impersonate #10953

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

quartzmo
Copy link
Member

@quartzmo quartzmo commented Oct 4, 2024

  • fix: return err if both Client and Credentials are set in CredentialsOptions
  • fix: propagate Credentials universe domain in httptransport.AddAuthorizationMiddleware

* fix: return err if both Client and Credentials are set in CredentialsOptions
* fix: propagate Credentials universe domain in httptransport.AddAuthorizationMiddleware
@quartzmo quartzmo requested a review from a team as a code owner October 4, 2024 21:25
// If a subject is specified a domain-wide delegation auth-flow is initiated
// to impersonate as the provided subject (user).
if opts.Subject != "" {
if !opts.isUniverseDomainGDU() {
gdu, err := isUniverseDomainGDU(universeDomainProvider)
Copy link
Member

Choose a reason for hiding this comment

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

Can this check be moved to the impl for the token provider? Having this code here puts this check at construction time vs usage-time.

// This is the universe domain configured for the credentials, which will be
// used in endpoint(s), and compared to the universe domain that is separately
// configured for the client.
func resolveUniverseDomainProvider(opts *CredentialsOptions, creds *auth.Credentials) auth.CredentialsPropertyProvider {
Copy link
Member

Choose a reason for hiding this comment

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

This seems like common logic that could be broadened and used consistently all over, similar to what we do for quotaproject. Could we do something similar here: https:/googleapis/google-cloud-go/blob/main/auth/internal/internal.go#L100

@@ -170,10 +171,14 @@ func AddAuthorizationMiddleware(client *http.Client, creds *auth.Credentials) er
base = http.DefaultTransport
}
}
clientUniverseDomain, err := creds.UniverseDomain(context.Background())
Copy link
Member

Choose a reason for hiding this comment

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

This now potentially can hard pull MDS, or at least could in the future. Can this be delayed?

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