Skip to content

feat: adds universe domain support for compute credentials#1346

Merged
TimurSadykov merged 19 commits intomainfrom
tpc-stage2
Jan 6, 2024
Merged

feat: adds universe domain support for compute credentials#1346
TimurSadykov merged 19 commits intomainfrom
tpc-stage2

Conversation

@TimurSadykov
Copy link
Copy Markdown

This adds universe domain support to GCE credentials.

In case explicit universe_domain was provided - it takes priority
Otherwise - GCE credential tries to obtain a universe domain from Metadata service

If request fails with 404 or request returns an empty string - universe domain is set to GDU
If any other error - throws a retryable exception

@TimurSadykov TimurSadykov requested review from a team December 26, 2023 18:30
@product-auto-label product-auto-label Bot added the size: l Pull request size is large. label Dec 26, 2023
Copy link
Copy Markdown

@einobie einobie left a comment

Choose a reason for hiding this comment

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

Ok

@Override
public LowLevelHttpRequest buildRequest(String method, String url) throws IOException {
if (url.equals(ComputeEngineCredentials.getTokenServerEncodedUrl())) {
return getMockRequestForTokenEndpoint(url);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This diff might be tricky to read. What I did is I factored out all the if-statements contents in a separate private methods. Some are big statements that made this method hard to read.

Comment thread oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java Outdated
Comment thread oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java Outdated
Comment thread oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java Outdated
Comment thread oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java Outdated
Comment thread oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jan 6, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@TimurSadykov TimurSadykov merged commit 7e26861 into main Jan 6, 2024
@TimurSadykov TimurSadykov deleted the tpc-stage2 branch January 6, 2024 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants