- Notifications
You must be signed in to change notification settings - Fork262
fix: GCECredentials - Allow retrieval of ID token#425
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
fix: GCECredentials - Allow retrieval of ID token#425
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View thisfailed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
conventional-commit-lint-gcfbot commentedApr 2, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use -- conventional-commit-lint bot |
1163c39 to97255afCompare| end | ||
| it"honors passing options to OAuth 2 client"do | ||
| stub=stub_request(:get,"http://169.254.169.254") |
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: since we're repeating this stub request. Can you put it in a variable?
bajajneha27 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.
Thanks for raising this PR. Just one tiny comment, overall LGTM
97255af to9c49861Compare| expect(creds).to_notbe_nil | ||
| describe"when on compute engine"do | ||
| beforedo | ||
| @compute_metadata_server=stub_request(:get,"http://169.254.169.254") |
StupidCodeFactoryApr 7, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
@bajajneha27 thanks for your feedback.
While one wouldnormally use alet!(:compute_metadata_server) as it's more idiomatic to RSpec test suite, this file seems to only be using@instance_variable so for the sake of consistency I've kept the pattern used in the file.
There seem to be a mixed use oflet andbefore { @instance_varialbe = "foo" } throughout the test suite. It's also unclear what is the preferred way.
As a long term rubyist I'd be inclined to favour thelet {}.
I'd be happy to convert this file from using@instance_variable tolet blocks, in this pull request or another one.
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.
This looks fine. Thanks for implementing this.
9c49861 to0158267Comparebajajneha27 commentedApr 10, 2023
@StupidCodeFactory , you'd have to update your branch with main. |
Passing of options down to the OAuth 2 client. optional options to GCEcredentials, enabling the creation of ID tokens.
0158267 tocc797e3Compare
Uh oh!
There was an error while loading.Please reload this page.
CONTEXT:
While deploying a couple of services on
Cloud RUN:roles/run.invokerfor service account B on service A.I expected to be able to retrieve an ID token and be able to call service A from service B. After some debugging I realised I was getting an
access_tokenrather then anid_token.I tracked it down to the GCECredentials instantiation only passing the scope to the subclass of theSignet::Oauth2::Client, hence not being able to pass the
target_audiencefor retrieve anid_tokenI believe this shouldfix:#299