-
Notifications
You must be signed in to change notification settings - Fork 615
feat(credential-provider-assume-role): add fromTokenFile credential provider #2147
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
Conversation
f1ec193
to
286099b
Compare
Codecov Report
@@ Coverage Diff @@
## main #2147 +/- ##
=======================================
Coverage ? 78.74%
=======================================
Files ? 381
Lines ? 16129
Branches ? 3463
=======================================
Hits ? 12701
Misses ? 3428
Partials ? 0 Continue to review full report at Codecov.
|
[source_profile]: true, | ||
}); | ||
|
||
return options.roleAssumer(await sourceCreds, { RoleArn, RoleSessionName }); |
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.
If we allow roleAssumer chaining here, should we allow other assume role options? Like MFA serial, and MFA token? I'm comparing to normal INI credential provider
aws-sdk-js-v3/packages/credential-provider-ini/src/index.ts
Lines 188 to 197 in 34cecf1
if (mfa_serial) { | |
if (!options.mfaCodeProvider) { | |
throw new ProviderError( | |
`Profile ${profileName} requires multi-factor authentication,` + ` but no MFA code callback was provided.`, | |
false | |
); | |
} | |
params.SerialNumber = mfa_serial; | |
params.TokenCode = await options.mfaCodeProvider(mfa_serial); | |
} |
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.
If we allow roleAssumer chaining here, should we allow other assume role options?
Short answer: Yes.
Long answer: Not in this PR. A separate PR should be created to introduce reusable fromAssumeRole
function.
Co-authored-by: AllanZhengYP <[email protected]>
bae849a
to
37864ed
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Decision after offline discussion with @AllanZhengYP :
The fromProcess and fromSSO credentials providers will be called from fromIni in future PRs. |
Closing in favor of the following PRs:
|
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. |
Issue
Fixes: #1808
Description
Adds fromTokenFile credential provider to read credentials from EKS service account.
If session name is not defined, it comes up with a role session name.
OIDC
token is storedTesting
A basic example of using fromTokenFile:
Values in environment variables
The values can be defined in environment varaibles as follows:
Values in configuration files
The values can be defined in configuration files as follows:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.