-
Notifications
You must be signed in to change notification settings - Fork 743
feat(auth): add STS credential management and mfa verification #7811
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
Changes from 6 commits
6722fb3
0ef9118
a350d98
27b0349
c50e67a
df3d5fc
e79313c
8342872
7d69f1d
4ed5e9c
5a71c09
74e5864
7212959
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -435,9 +435,50 @@ describe('AuthUtil', async function () { | |
|
|
||
| assert.ok(mockIamLogin.login.calledOnce) | ||
| assert.ok( | ||
| mockIamLogin.login.calledWith({ | ||
| mockIamLogin.login.calledWithMatch({ | ||
| accessKey: 'accessKey', | ||
| secretKey: 'secretKey', | ||
| sessionToken: 'sessionToken', | ||
| }) | ||
| ) | ||
| assert.strictEqual(response, mockResponse) | ||
| }) | ||
|
|
||
| it('creates IAM session with role ARN', async function () { | ||
| const mockResponse = { | ||
| id: 'test-credential-id', | ||
| credentials: { | ||
| accessKeyId: 'encrypted-access-key', | ||
| secretAccessKey: 'encrypted-secret-key', | ||
| sessionToken: 'encrypted-session-token', | ||
| roleArn: 'arn:aws:iam::123456789012:role/TestRole', | ||
| }, | ||
| updateCredentialsParams: { | ||
| data: 'credential-data', | ||
| }, | ||
| } | ||
|
|
||
| const mockIamLoginArn = { | ||
| login: sinon.stub().resolves(mockResponse), | ||
| loginType: 'iam', | ||
| } | ||
|
|
||
| sinon.stub(auth2, 'IamLogin').returns(mockIamLoginArn as any) | ||
|
|
||
| const response = await auth.loginIam( | ||
| 'accessKey', | ||
|
||
| 'secretKey', | ||
| 'sessionToken', | ||
| 'arn:aws:iam::123456789012:role/TestRole' | ||
| ) | ||
|
|
||
| assert.ok(mockIamLoginArn.login.calledOnce) | ||
| assert.ok( | ||
| mockIamLoginArn.login.calledWith({ | ||
| accessKey: 'accessKey', | ||
| secretKey: 'secretKey', | ||
| sessionToken: 'sessionToken', | ||
| roleArn: 'arn:aws:iam::123456789012:role/TestRole', | ||
| }) | ||
| ) | ||
| assert.strictEqual(response, mockResponse) | ||
|
|
||
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.
Does a type exist that we could do:
} as ReturnTypeOfLoginso that the actual fields are type checked?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.
Yes, I will add this.