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

fix: downscope credentials used for IAM AuthN login #999

Merged
merged 15 commits into from
Nov 2, 2022
Merged

Conversation

shubha-rajan
Copy link
Contributor

@shubha-rajan shubha-rajan requested a review from a team September 30, 2022 16:35
@shubha-rajan
Copy link
Contributor Author

Looks like the Code Coverage check wants me to add a test

@shubha-rajan shubha-rajan marked this pull request as draft September 30, 2022 16:54
@enocom
Copy link
Member

enocom commented Sep 30, 2022

One option for writing a test: extract the logic here into a method that accepts a Credentials object. Then you could test what happens when that token does not supported GoogleCredentials, what happens when the credentials are scoped, etc.

@@ -526,7 +528,17 @@ private Certificate fetchEphemeralCertificate(KeyPair keyPair) {
if (enableIamAuth) {
try {
credentials.get().refresh();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we refresh after we downscope?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately no, we get a nullpointer if we do that.

@shubha-rajan shubha-rajan force-pushed the downscoping branch 3 times, most recently from c52260a to 53e4480 Compare October 8, 2022 01:58
@shubha-rajan shubha-rajan marked this pull request as ready for review October 10, 2022 16:16
@kurtisvg kurtisvg self-requested a review October 25, 2022 20:41
@shubha-rajan shubha-rajan added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 27, 2022
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 27, 2022
@shubha-rajan shubha-rajan added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 27, 2022
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 27, 2022
@shubha-rajan shubha-rajan force-pushed the downscoping branch 5 times, most recently from 6e24cb5 to f670014 Compare October 28, 2022 06:20
Comment on lines 530 to 531
OAuth2Credentials creds = credentials.get();
creds.refresh();
GoogleCredentials downscoped = getDownscopedCredentials(creds);
downscoped.refresh();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to better understand why we need to refresh twice here?

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.

Downscope OAuth2 token included in ephemeral certificate
4 participants