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(credential-provider-sso): support resolving credentials from SSO token #2055

Merged
merged 7 commits into from
Feb 25, 2021

Conversation

AllanZhengYP
Copy link
Contributor

Issue

Resolves: #1158

Description

Add a credential provider that resolves the cached SSO token by cli-configure-sso


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Base automatically changed from master to main February 22, 2021 19:46
@AllanZhengYP AllanZhengYP marked this pull request as ready for review February 23, 2021 00:51
@AllanZhengYP
Copy link
Contributor Author

The Codebuild fails when running yarn --frozen-lockfile. The log is shown as bellow.

yarn install v1.22.5
37 | [1/4] Resolving packages...
38 | [2/4] Fetching packages...
39 | info fsevents@2.3.2: The platform "linux" is incompatible with this module.
40 | info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
41 | info fsevents@1.2.13: The platform "linux" is incompatible with this module.
42 | info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
43 | [3/4] Linking dependencies...
44 | warning "lerna > @lerna/version > @lerna/github-client > @octokit/rest > @octokit/plugin-request-log@1.0.3" has unmet peer dependency "@octokit/core@>=3".
45 | warning " > typedoc-plugin-lerna-packages@0.3.1" has unmet peer dependency "typedoc@^0.17.0".
46 | warning "workspace-aggregator-27c30dae-4809-4a7d-9a4d-7daa3bf2385f > @aws-sdk/client-kafka > typedoc@0.19.2" has incorrect peer dependency "typescript@3.9.x \|\| 4.0.x".
47 | warning "workspace-aggregator-27c30dae-4809-4a7d-9a4d-7daa3bf2385f > @aws-sdk/middleware-retry > react-native-get-random-values@1.6.0" has unmet peer dependency "react-native@>=0.56".
48 | error An unexpected error occurred: "ENOENT: no such file or directory, lstat '/codebuild/output/src829467270/src/github.com/aws/aws-sdk-js-v3/clients/client-sso/node_modules/@types'".
49 | info If you think this is a bug, please open a bug report with the information provided in "/codebuild/output/src829467270/src/github.com/aws/aws-sdk-js-v3/yarn-error.log".
50 | info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
51

I cannot reproduce it on my machine. It very wierd that the error will gone if run yarn --frozen-lockfile again. There's no diff after installation either.

@AllanZhengYP
Copy link
Contributor Author

AllanZhengYP commented Feb 23, 2021

It turns out caused by recursive dependency: client-sso -> credential-provider-node -> credential-provider-sso -> client-sso

The root cause is still unclear. But changing to not hoisting the @aws-sdk/client-sso fixes the problem. I have tested with S3 with local registry and Webpack. I can confirm they work fine.

Yarn install would fail with client-sso/node_modules/@type no exist
if hoisted.
@codecov-io
Copy link

codecov-io commented Feb 24, 2021

Codecov Report

❗ No coverage uploaded for pull request base (main@23e48de). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2055   +/-   ##
=======================================
  Coverage        ?   79.51%           
=======================================
  Files           ?      367           
  Lines           ?    15369           
  Branches        ?     3319           
=======================================
  Hits            ?    12220           
  Misses          ?     3149           
  Partials        ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 23e48de...afa15e6. Read the comment docs.

Copy link
Member

@trivikr trivikr left a comment

Choose a reason for hiding this comment

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

LGTM, minor comments.

packages/credential-provider-sso/README.md Outdated Show resolved Hide resolved
packages/credential-provider-sso/README.md Outdated Show resolved Hide resolved
packages/credential-provider-sso/README.md Outdated Show resolved Hide resolved
packages/credential-provider-sso/README.md Outdated Show resolved Hide resolved
packages/credential-provider-sso/README.md Outdated Show resolved Hide resolved
packages/credential-provider-node/src/index.spec.ts Outdated Show resolved Hide resolved
packages/credential-provider-sso/src/index.ts Outdated Show resolved Hide resolved
packages/credential-provider-sso/src/index.ts Outdated Show resolved Hide resolved
packages/credential-provider-sso/src/index.ts Outdated Show resolved Hide resolved
packages/credential-provider-sso/src/index.ts Outdated Show resolved Hide resolved
Co-authored-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com>
packages/credential-provider-sso/README.md Outdated Show resolved Hide resolved
@AllanZhengYP AllanZhengYP merged commit 1429ad1 into aws:main Feb 25, 2021
@aws-sdk-js-automation
Copy link

AWS CodeBuild CI Report

  • CodeBuild project: sdk-staging-test
  • Commit ID: 4e51a8d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for credentials via AWS SSO
4 participants