-
Notifications
You must be signed in to change notification settings - Fork 269
feat: Support retrieving ID Token from IAM endpoint for ServiceAccountCredentials #1433
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
Conversation
zhumin8
left a comment
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.
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.
oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java
Outdated
Show resolved
Hide resolved
|
|
||
| @Test | ||
| public void idTokenWithAudience_incorrect() throws IOException { | ||
| public void idTokenWithAudience_oauthFlow_incorrect() throws IOException { |
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.
Maybe something like idTokenWithAudience_oauthFlow_incorrectAudience() to be more specific on the test?
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.
Sounds good, will update!
oauth2_http/javatests/com/google/auth/oauth2/ServiceAccountCredentialsTest.java
Show resolved
Hide resolved
…als.java Co-authored-by: Min Zhu <zhumin@google.com>
zhumin8
left a comment
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.
LGTM.
only a few nit picks.
| String assertion = | ||
| createAssertionForIdToken( | ||
| jsonFactory, currentTime, tokenServerUri.toString(), targetAudience); | ||
| createAssertionForIdToken(currentTime, tokenServerUri.toString(), targetAudience); |
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.
For readability, perhaps rename tokenServerUri tooauthIdTokenUri in parallel to iamIdTokenUri?
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.
| URI iamIdTokenUri = | ||
| URI.create( | ||
| String.format( | ||
| OAuth2Utils.IAM_ID_TOKEN_ENDPOINT_FORMAT, getUniverseDomain(), clientEmail)); |
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.
nit: Can we be consistent with iamIdTokenUri and tokenServerUri? either both declare as class variable or both inside respective get endpoint method.
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.
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.
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.
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.
|
arithmetic1728
left a comment
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.
LGTM
|



See b/340613207 for more information.