Skip to content

Conversation

@lqiu96
Copy link
Member

@lqiu96 lqiu96 commented Jul 9, 2024

See b/340613207 for more information.

@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Jul 9, 2024
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Jul 10, 2024
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: l Pull request size is large. labels Jul 10, 2024
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Jul 11, 2024
Copy link
Contributor

@zhumin8 zhumin8 left a comment

Choose a reason for hiding this comment

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

The high level logic seems reasonable to me, still trying to get a better understanding of the id-token workflow. I will give it a second try after I do some readings on the context.


@Test
public void idTokenWithAudience_incorrect() throws IOException {
public void idTokenWithAudience_oauthFlow_incorrect() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe something like idTokenWithAudience_oauthFlow_incorrectAudience() to be more specific on the test?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good, will update!

@lqiu96 lqiu96 marked this pull request as ready for review July 11, 2024 21:08
@lqiu96 lqiu96 requested a review from a team as a code owner July 11, 2024 21:08
Copy link
Contributor

@zhumin8 zhumin8 left a comment

Choose a reason for hiding this comment

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

LGTM.
only a few nit picks.

String assertion =
createAssertionForIdToken(
jsonFactory, currentTime, tokenServerUri.toString(), targetAudience);
createAssertionForIdToken(currentTime, tokenServerUri.toString(), targetAudience);
Copy link
Contributor

Choose a reason for hiding this comment

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

For readability, perhaps rename tokenServerUri tooauthIdTokenUri in parallel to iamIdTokenUri?

Copy link
Member Author

@lqiu96 lqiu96 Jul 23, 2024

Choose a reason for hiding this comment

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

tokenServerUri has getters and setters that match the variable name. I think it would be too confusing to change the variable name.

Comment on lines +628 to +631
URI iamIdTokenUri =
URI.create(
String.format(
OAuth2Utils.IAM_ID_TOKEN_ENDPOINT_FORMAT, getUniverseDomain(), clientEmail));
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Can we be consistent with iamIdTokenUri and tokenServerUri? either both declare as class variable or both inside respective get endpoint method.

Copy link
Member Author

Choose a reason for hiding this comment

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

tokenServerUri is a customizable from setters and can't be declared as a class variable. iamIdTokenUri probably can be initialized in the constructor and I'll move it up there.

Copy link
Member Author

Choose a reason for hiding this comment

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

On second thought, getUniverseDomain() throws an IOException and adding a checked exception to the constructor is a breaking change. I think it would be better to leave it here.

@sonarqubecloud
Copy link

@lqiu96 lqiu96 requested a review from westarle July 31, 2024 21:55
Copy link
Contributor

@arithmetic1728 arithmetic1728 left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarqubecloud
Copy link

@lqiu96 lqiu96 merged commit 4fcf83e into main Aug 29, 2024
@lqiu96 lqiu96 deleted the id_token_support branch August 29, 2024 15:26
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.

3 participants