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

feat: add workforce config support. #1251

Merged
merged 15 commits into from
Sep 28, 2021

Conversation

xil222
Copy link
Contributor

@xil222 xil222 commented Sep 13, 2021

See go/workforce-pools-client-support.

Add support of work_force_user_config field for workforce pool and related logic in ExternalClient(calling constructor for IdentityPoolClient) BaseExternalClient(the parent class of IdentityPoolClient).
The logic change is only related to refreshAccessToken() flow, since this API is non-public, we use getAccessToken() to test the flow instead.

Add 16 tests:
ExternalClient:

  1. fromJson() for IdentityPoolClient, throw an error is work_force_user_project provided by audience is not workforce audience.
  2. fromJson() For IdentityPoolClient, return expected response is work_force_user_project provided and audience is workforce audience.

BaseExternalClient:

  1. getAccessToken() Should apply basic auth on workforce configs with client auth provided(no impersonation).
  2. getAccessToken() Should apply work_force_user_project on workforce configs without client auth(no impersonation).
  3. getAccessToken() Should not throw if workforce audience and client auth but work_force_user_project not provided(no impersonation).
  4. getAccessToken() Should not throw if workforce audience and no client auth but work_force_user_project provided( impersonation).
  5. Constructor(), throw an error is work_force_user_project provided by audience is not workforce audience.
  6. Constructor(), return expected response is work_force_user_project provided and audience is workforce audience.
  7. getProjectId(), should resolve with workforce projectID if no client auth not and workforce user project are defined.
  8. getProjectId(), should not pass workforce user project if client auth is defined.

IdentityPoolClient:

  1. getAccessToken() Should apply basic auth on workforce configs with client auth provided(no impersonation).
  2. getAccessToken() Should apply work_force_user_project on workforce configs without client auth(no impersonation).
  3. getAccessToken() Should not throw if workforce audience and client auth but work_force_user_project not provided(no impersonation).
  4. getAccessToken() Should not throw if workforce audience and no client auth but work_force_user_project provided( impersonation).
  5. Constructor(), throw an error is work_force_user_project provided by audience is not workforce audience.
  6. Constructor(), return expected response is work_force_user_project provided and audience is workforce audience.

@xil222 xil222 requested review from a team as code owners September 13, 2021 19:30
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Sep 13, 2021
@bcoe bcoe added the owlbot:run Add this label to trigger the Owlbot post processor. label Sep 14, 2021
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Sep 14, 2021
src/auth/baseexternalclient.ts Outdated Show resolved Hide resolved
src/auth/baseexternalclient.ts Outdated Show resolved Hide resolved
src/auth/externalclient.ts Outdated Show resolved Hide resolved
src/auth/externalclient.ts Outdated Show resolved Hide resolved
src/auth/baseexternalclient.ts Outdated Show resolved Hide resolved
test/test.externalclient.ts Outdated Show resolved Hide resolved
test/test.externalclient.ts Outdated Show resolved Hide resolved
test/test.externalclient.ts Outdated Show resolved Hide resolved
test/test.externalclient.ts Outdated Show resolved Hide resolved
test/test.externalclient.ts Outdated Show resolved Hide resolved
@xil222 xil222 requested a review from lsirac September 15, 2021 20:52
src/auth/identitypoolclient.ts Outdated Show resolved Hide resolved
src/auth/baseexternalclient.ts Show resolved Hide resolved
test/test.baseexternalclient.ts Outdated Show resolved Hide resolved
test/test.baseexternalclient.ts Outdated Show resolved Hide resolved
test/test.baseexternalclient.ts Outdated Show resolved Hide resolved
test/test.baseexternalclient.ts Outdated Show resolved Hide resolved
test/test.externalclient.ts Outdated Show resolved Hide resolved
test/test.externalclient.ts Show resolved Hide resolved
test/test.externalclient.ts Outdated Show resolved Hide resolved
test/test.externalclient.ts Outdated Show resolved Hide resolved
test/test.identitypoolclient.ts Show resolved Hide resolved
src/auth/identitypoolclient.ts Outdated Show resolved Hide resolved
test/test.identitypoolclient.ts Outdated Show resolved Hide resolved
@xil222 xil222 requested a review from lsirac September 17, 2021 17:10
@xil222 xil222 requested a review from lsirac September 22, 2021 23:29
src/auth/baseexternalclient.ts Show resolved Hide resolved
src/auth/baseexternalclient.ts Outdated Show resolved Hide resolved
src/auth/baseexternalclient.ts Show resolved Hide resolved
src/auth/baseexternalclient.ts Outdated Show resolved Hide resolved
src/auth/identitypoolclient.ts Outdated Show resolved Hide resolved
test/test.baseexternalclient.ts Show resolved Hide resolved
src/auth/identitypoolclient.ts Outdated Show resolved Hide resolved
test/test.identitypoolclient.ts Show resolved Hide resolved
src/auth/baseexternalclient.ts Outdated Show resolved Hide resolved
@bcoe
Copy link
Contributor

bcoe commented Sep 24, 2021

@xil222 will take a look as soon as @bojeil-google has given 👍

@xil222
Copy link
Contributor Author

xil222 commented Sep 24, 2021

@xil222 will take a look as soon as @bojeil-google has given 👍

ok, thanks

src/auth/baseexternalclient.ts Outdated Show resolved Hide resolved
src/auth/baseexternalclient.ts Outdated Show resolved Hide resolved
test/test.baseexternalclient.ts Outdated Show resolved Hide resolved
test/test.identitypoolclient.ts Outdated Show resolved Hide resolved
test/test.baseexternalclient.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@bojeil-google bojeil-google left a comment

Choose a reason for hiding this comment

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

Changes look good from my end. Thanks a lot for putting this together!

@bcoe bcoe added the owlbot:run Add this label to trigger the Owlbot post processor. label Sep 28, 2021
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Sep 28, 2021
@bcoe bcoe added the automerge Merge the pull request once unit tests and other checks pass. label Sep 28, 2021
@bcoe bcoe changed the title feat: Add workforce config support. feat: add workforce config support. Sep 28, 2021
@gcf-merge-on-green gcf-merge-on-green bot merged commit fe29e38 into googleapis:main Sep 28, 2021
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants