-
Notifications
You must be signed in to change notification settings - Fork 119
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
Conversation
Looks like the Code Coverage check wants me to add a test |
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(); |
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.
Can we refresh after we downscope?
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.
Unfortunately no, we get a nullpointer if we do that.
c52260a
to
53e4480
Compare
274f5f7
to
25a371a
Compare
25a371a
to
a7ff4af
Compare
6e24cb5
to
f670014
Compare
OAuth2Credentials creds = credentials.get(); | ||
creds.refresh(); | ||
GoogleCredentials downscoped = getDownscopedCredentials(creds); | ||
downscoped.refresh(); |
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.
I'd like to better understand why we need to refresh twice here?
f4d0267
to
ace1c22
Compare
0012692
to
f909ac8
Compare
Relevant issues: