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
feat: adds README, samples and integration tests for downscoping with CAB #1311
Conversation
Warning: This pull request is touching the following templated files:
|
Hi @bcoe , could you get back to me when you are back? |
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.
Just did a quick first pass. Can you also take a look at the lint warnings on the downscoped files?
…le-auth-library-nodejs into xinxinxin-cabsamples
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.
Just one nit about tests, also question about API, mainly how does this compare to other implementations? Should we be planning work to give Node.js a more ergonomic API for extending the auth library.
projectId: 'my_project_id', | ||
authClient: { | ||
sign: () => Promise.reject('unsupported'), | ||
getCredentials: () => Promise.reject(), |
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 approach you came up with here ends up not looking quite as ugly as I was fearing.
How does this compare to Python and other languages? Is there work we should be tracking to make this API easier?
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.
In Python and Java directly passing authClient as variable to create Storage object without need to redefine a couple of APIs such as sign() or getCredentials().
And, yes, the long-term work is referred in last PR
GoogleCloudPlatform/nodejs-docs-samples#2368 (comment)
and you can track in bug b/196442993
just made it correct |
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.
Overall this looks fine. However, this deviates from existing samples/integration tests.
The pattern is to have a sample file with output under this directory: https://github.com/googleapis/google-auth-library-nodejs/tree/main/samples
Example: https://github.com/googleapis/google-auth-library-nodejs/blob/main/samples/signBlob.js
Then you would write the test asserting the output of the sample (via child_process.exec
) in here:
https://github.com/googleapis/google-auth-library-nodejs/tree/main/samples/test
You could try to pass the bucket and object name via environment variable. Similar to here:
|
🤖 I have created a release \*beep\* \*boop\* --- ## [7.11.0](https://www.github.com/googleapis/google-auth-library-nodejs/compare/v7.10.4...v7.11.0) (2021-12-15) ### Features * adds README, samples and integration tests for downscoping with CAB ([#1311](https://www.github.com/googleapis/google-auth-library-nodejs/issues/1311)) ([4549116](https://www.github.com/googleapis/google-auth-library-nodejs/commit/454911637eca6a1272a729b2b2dfcf690c53fe29)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This PR does the followings for downscoping with CAB.