@aws-sdk/client-sts 3.35.0 → 3.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/dist-cjs/STS.js +0 -8
- package/dist-cjs/STSClient.js +0 -13
- package/dist-cjs/commands/AssumeRoleCommand.js +0 -108
- package/dist-cjs/commands/AssumeRoleWithSAMLCommand.js +0 -156
- package/dist-cjs/commands/AssumeRoleWithWebIdentityCommand.js +0 -160
- package/dist-cjs/commands/DecodeAuthorizationMessageCommand.js +0 -60
- package/dist-cjs/commands/GetAccessKeyInfoCommand.js +0 -42
- package/dist-cjs/commands/GetCallerIdentityCommand.js +0 -34
- package/dist-cjs/commands/GetFederationTokenCommand.js +0 -163
- package/dist-cjs/commands/GetSessionTokenCommand.js +0 -76
- package/dist-cjs/commands/index.js +11 -0
- package/dist-cjs/defaultRoleAssumers.js +0 -17
- package/dist-cjs/defaultStsRoleAssumers.js +0 -21
- package/dist-cjs/endpoints.js +1 -2
- package/dist-cjs/index.js +3 -11
- package/dist-cjs/models/index.js +0 -1
- package/dist-cjs/models/models_0.js +0 -88
- package/dist-cjs/protocols/Aws_query.js +0 -3
- package/dist-cjs/runtimeConfig.browser.js +1 -6
- package/dist-cjs/runtimeConfig.js +3 -8
- package/dist-cjs/runtimeConfig.native.js +0 -4
- package/dist-cjs/runtimeConfig.shared.js +0 -4
- package/dist-es/STS.js +0 -1
- package/dist-es/STSClient.js +0 -1
- package/dist-es/commands/AssumeRoleCommand.js +0 -1
- package/dist-es/commands/AssumeRoleWithSAMLCommand.js +0 -1
- package/dist-es/commands/AssumeRoleWithWebIdentityCommand.js +0 -1
- package/dist-es/commands/DecodeAuthorizationMessageCommand.js +0 -1
- package/dist-es/commands/GetAccessKeyInfoCommand.js +0 -1
- package/dist-es/commands/GetCallerIdentityCommand.js +0 -1
- package/dist-es/commands/GetFederationTokenCommand.js +0 -1
- package/dist-es/commands/GetSessionTokenCommand.js +0 -1
- package/dist-es/commands/index.js +8 -0
- package/dist-es/defaultRoleAssumers.js +0 -1
- package/dist-es/defaultStsRoleAssumers.js +0 -1
- package/dist-es/endpoints.js +1 -2
- package/dist-es/index.js +3 -11
- package/dist-es/models/index.js +0 -1
- package/dist-es/models/models_0.js +0 -1
- package/dist-es/protocols/Aws_query.js +0 -1
- package/dist-es/runtimeConfig.browser.js +1 -2
- package/dist-es/runtimeConfig.js +3 -4
- package/dist-es/runtimeConfig.native.js +0 -1
- package/dist-es/runtimeConfig.shared.js +0 -1
- package/dist-types/commands/index.d.ts +8 -0
- package/dist-types/index.d.ts +3 -10
- package/dist-types/ts3.4/STS.d.ts +9 -630
- package/dist-types/ts3.4/STSClient.d.ts +24 -93
- package/dist-types/ts3.4/commands/AssumeRoleCommand.d.ts +2 -103
- package/dist-types/ts3.4/commands/AssumeRoleWithSAMLCommand.d.ts +2 -151
- package/dist-types/ts3.4/commands/AssumeRoleWithWebIdentityCommand.d.ts +2 -155
- package/dist-types/ts3.4/commands/DecodeAuthorizationMessageCommand.d.ts +2 -55
- package/dist-types/ts3.4/commands/GetAccessKeyInfoCommand.d.ts +2 -37
- package/dist-types/ts3.4/commands/GetCallerIdentityCommand.d.ts +2 -29
- package/dist-types/ts3.4/commands/GetFederationTokenCommand.d.ts +2 -158
- package/dist-types/ts3.4/commands/GetSessionTokenCommand.d.ts +2 -71
- package/dist-types/ts3.4/commands/index.d.ts +8 -0
- package/dist-types/ts3.4/defaultRoleAssumers.d.ts +3 -14
- package/dist-types/ts3.4/defaultStsRoleAssumers.d.ts +6 -25
- package/dist-types/ts3.4/index.d.ts +3 -10
- package/dist-types/ts3.4/models/models_0.d.ts +123 -948
- package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -3
- package/dist-types/ts3.4/runtimeConfig.d.ts +1 -3
- package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -3
- package/dist-types/ts3.4/runtimeConfig.shared.d.ts +1 -3
- package/package.json +33 -30
- package/dist-cjs/STS.js.map +0 -1
- package/dist-cjs/STSClient.js.map +0 -1
- package/dist-cjs/commands/AssumeRoleCommand.js.map +0 -1
- package/dist-cjs/commands/AssumeRoleWithSAMLCommand.js.map +0 -1
- package/dist-cjs/commands/AssumeRoleWithWebIdentityCommand.js.map +0 -1
- package/dist-cjs/commands/DecodeAuthorizationMessageCommand.js.map +0 -1
- package/dist-cjs/commands/GetAccessKeyInfoCommand.js.map +0 -1
- package/dist-cjs/commands/GetCallerIdentityCommand.js.map +0 -1
- package/dist-cjs/commands/GetFederationTokenCommand.js.map +0 -1
- package/dist-cjs/commands/GetSessionTokenCommand.js.map +0 -1
- package/dist-cjs/defaultRoleAssumers.js.map +0 -1
- package/dist-cjs/defaultStsRoleAssumers.js.map +0 -1
- package/dist-cjs/endpoints.js.map +0 -1
- package/dist-cjs/index.js.map +0 -1
- package/dist-cjs/models/index.js.map +0 -1
- package/dist-cjs/models/models_0.js.map +0 -1
- package/dist-cjs/protocols/Aws_query.js.map +0 -1
- package/dist-cjs/runtimeConfig.browser.js.map +0 -1
- package/dist-cjs/runtimeConfig.js.map +0 -1
- package/dist-cjs/runtimeConfig.native.js.map +0 -1
- package/dist-cjs/runtimeConfig.shared.js.map +0 -1
- package/dist-es/STS.js.map +0 -1
- package/dist-es/STSClient.js.map +0 -1
- package/dist-es/commands/AssumeRoleCommand.js.map +0 -1
- package/dist-es/commands/AssumeRoleWithSAMLCommand.js.map +0 -1
- package/dist-es/commands/AssumeRoleWithWebIdentityCommand.js.map +0 -1
- package/dist-es/commands/DecodeAuthorizationMessageCommand.js.map +0 -1
- package/dist-es/commands/GetAccessKeyInfoCommand.js.map +0 -1
- package/dist-es/commands/GetCallerIdentityCommand.js.map +0 -1
- package/dist-es/commands/GetFederationTokenCommand.js.map +0 -1
- package/dist-es/commands/GetSessionTokenCommand.js.map +0 -1
- package/dist-es/defaultRoleAssumers.js.map +0 -1
- package/dist-es/defaultStsRoleAssumers.js.map +0 -1
- package/dist-es/endpoints.js.map +0 -1
- package/dist-es/index.js.map +0 -1
- package/dist-es/models/index.js.map +0 -1
- package/dist-es/models/models_0.js.map +0 -1
- package/dist-es/protocols/Aws_query.js.map +0 -1
- package/dist-es/runtimeConfig.browser.js.map +0 -1
- package/dist-es/runtimeConfig.js.map +0 -1
- package/dist-es/runtimeConfig.native.js.map +0 -1
- package/dist-es/runtimeConfig.shared.js.map +0 -1
- package/jest.config.js +0 -4
- package/src/STS.ts +0 -897
- package/src/STSClient.ts +0 -264
- package/src/commands/AssumeRoleCommand.ts +0 -177
- package/src/commands/AssumeRoleWithSAMLCommand.ts +0 -226
- package/src/commands/AssumeRoleWithWebIdentityCommand.ts +0 -233
- package/src/commands/DecodeAuthorizationMessageCommand.ts +0 -135
- package/src/commands/GetAccessKeyInfoCommand.ts +0 -114
- package/src/commands/GetCallerIdentityCommand.ts +0 -106
- package/src/commands/GetFederationTokenCommand.ts +0 -235
- package/src/commands/GetSessionTokenCommand.ts +0 -148
- package/src/defaultRoleAssumers.ts +0 -41
- package/src/defaultStsRoleAssumers.ts +0 -126
- package/src/endpoints.ts +0 -91
- package/src/index.ts +0 -12
- package/src/models/index.ts +0 -1
- package/src/models/models_0.ts +0 -1361
- package/src/protocols/Aws_query.ts +0 -1514
- package/src/runtimeConfig.browser.ts +0 -41
- package/src/runtimeConfig.native.ts +0 -17
- package/src/runtimeConfig.shared.ts +0 -17
- package/src/runtimeConfig.ts +0 -46
- package/test/defaultRoleAssumers.spec.ts +0 -149
- package/tsconfig.es.json +0 -10
- package/tsconfig.json +0 -33
- package/tsconfig.types.json +0 -9
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Sha256 } from "@aws-crypto/sha256-browser";
|
|
2
|
-
import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler";
|
|
3
|
-
import { invalidProvider } from "@aws-sdk/invalid-dependency";
|
|
4
|
-
import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry";
|
|
5
|
-
import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser";
|
|
6
|
-
import { calculateBodyLength } from "@aws-sdk/util-body-length-browser";
|
|
7
|
-
import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser";
|
|
8
|
-
import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser";
|
|
9
|
-
|
|
10
|
-
// @ts-ignore: package.json will be imported from dist folders
|
|
11
|
-
import packageInfo from "../package.json";
|
|
12
|
-
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
13
|
-
import { STSClientConfig } from "./STSClient";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
export const getRuntimeConfig = (config: STSClientConfig) => {
|
|
19
|
-
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
20
|
-
return {
|
|
21
|
-
...clientSharedValues,
|
|
22
|
-
...config,
|
|
23
|
-
runtime: "browser",
|
|
24
|
-
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
25
|
-
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
26
|
-
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
27
|
-
credentialDefaultProvider:
|
|
28
|
-
config?.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))),
|
|
29
|
-
defaultUserAgentProvider:
|
|
30
|
-
config?.defaultUserAgentProvider ??
|
|
31
|
-
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
32
|
-
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
|
|
33
|
-
region: config?.region ?? invalidProvider("Region is missing"),
|
|
34
|
-
requestHandler: config?.requestHandler ?? new FetchHttpHandler(),
|
|
35
|
-
retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)),
|
|
36
|
-
sha256: config?.sha256 ?? Sha256,
|
|
37
|
-
streamCollector: config?.streamCollector ?? streamCollector,
|
|
38
|
-
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
39
|
-
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
40
|
-
};
|
|
41
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Sha256 } from "@aws-crypto/sha256-js";
|
|
2
|
-
|
|
3
|
-
import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
|
|
4
|
-
import { STSClientConfig } from "./STSClient";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export const getRuntimeConfig = (config: STSClientConfig) => {
|
|
10
|
-
const browserDefaults = getBrowserRuntimeConfig(config);
|
|
11
|
-
return {
|
|
12
|
-
...browserDefaults,
|
|
13
|
-
...config,
|
|
14
|
-
runtime: "react-native",
|
|
15
|
-
sha256: config?.sha256 ?? Sha256,
|
|
16
|
-
};
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Logger as __Logger } from "@aws-sdk/types";
|
|
2
|
-
import { parseUrl } from "@aws-sdk/url-parser";
|
|
3
|
-
|
|
4
|
-
import { defaultRegionInfoProvider } from "./endpoints";
|
|
5
|
-
import { STSClientConfig } from "./STSClient";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export const getRuntimeConfig = (config: STSClientConfig) => ({
|
|
11
|
-
apiVersion: "2011-06-15",
|
|
12
|
-
disableHostPrefix: config?.disableHostPrefix ?? false,
|
|
13
|
-
logger: config?.logger ?? ({} as __Logger),
|
|
14
|
-
regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider,
|
|
15
|
-
serviceId: config?.serviceId ?? "STS",
|
|
16
|
-
urlParser: config?.urlParser ?? parseUrl,
|
|
17
|
-
});
|
package/src/runtimeConfig.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS } from "@aws-sdk/config-resolver";
|
|
2
|
-
import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
|
|
3
|
-
import { Hash } from "@aws-sdk/hash-node";
|
|
4
|
-
import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry";
|
|
5
|
-
import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider";
|
|
6
|
-
import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler";
|
|
7
|
-
import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client";
|
|
8
|
-
import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node";
|
|
9
|
-
import { calculateBodyLength } from "@aws-sdk/util-body-length-node";
|
|
10
|
-
import { defaultUserAgent } from "@aws-sdk/util-user-agent-node";
|
|
11
|
-
import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node";
|
|
12
|
-
|
|
13
|
-
// @ts-ignore: package.json will be imported from dist folders
|
|
14
|
-
import packageInfo from "../package.json";
|
|
15
|
-
import { decorateDefaultCredentialProvider } from "./defaultStsRoleAssumers";
|
|
16
|
-
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
17
|
-
import { STSClientConfig } from "./STSClient";
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
export const getRuntimeConfig = (config: STSClientConfig) => {
|
|
23
|
-
emitWarningIfUnsupportedVersion(process.version);
|
|
24
|
-
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
25
|
-
return {
|
|
26
|
-
...clientSharedValues,
|
|
27
|
-
...config,
|
|
28
|
-
runtime: "node",
|
|
29
|
-
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
30
|
-
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
31
|
-
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
32
|
-
credentialDefaultProvider:
|
|
33
|
-
config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider),
|
|
34
|
-
defaultUserAgentProvider:
|
|
35
|
-
config?.defaultUserAgentProvider ??
|
|
36
|
-
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
37
|
-
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
|
|
38
|
-
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
|
|
39
|
-
requestHandler: config?.requestHandler ?? new NodeHttpHandler(),
|
|
40
|
-
retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS),
|
|
41
|
-
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
|
42
|
-
streamCollector: config?.streamCollector ?? streamCollector,
|
|
43
|
-
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
44
|
-
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
45
|
-
};
|
|
46
|
-
};
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
// Please do not touch this file. It's generated from template in:
|
|
2
|
-
// https://github.com/aws/aws-sdk-js-v3/blob/main/codegen/smithy-aws-typescript-codegen/src/main/resources/software/amazon/smithy/aws/typescript/codegen/sts-client-defaultRoleAssumers.spec.ts
|
|
3
|
-
import { HttpResponse } from "@aws-sdk/protocol-http";
|
|
4
|
-
import { Readable } from "stream";
|
|
5
|
-
|
|
6
|
-
const mockHandle = jest.fn().mockResolvedValue({
|
|
7
|
-
response: new HttpResponse({
|
|
8
|
-
statusCode: 200,
|
|
9
|
-
body: Readable.from([""]),
|
|
10
|
-
}),
|
|
11
|
-
});
|
|
12
|
-
jest.mock("@aws-sdk/node-http-handler", () => ({
|
|
13
|
-
NodeHttpHandler: jest.fn().mockImplementation(() => ({
|
|
14
|
-
destroy: () => {},
|
|
15
|
-
handle: mockHandle,
|
|
16
|
-
})),
|
|
17
|
-
streamCollector: jest.fn(),
|
|
18
|
-
}));
|
|
19
|
-
|
|
20
|
-
import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler";
|
|
21
|
-
|
|
22
|
-
import type { AssumeRoleCommandInput } from "../src/commands/AssumeRoleCommand";
|
|
23
|
-
import { AssumeRoleWithWebIdentityCommandInput } from "../src/commands/AssumeRoleWithWebIdentityCommand";
|
|
24
|
-
import { getDefaultRoleAssumer, getDefaultRoleAssumerWithWebIdentity } from "../src/defaultRoleAssumers";
|
|
25
|
-
const mockConstructorInput = jest.fn();
|
|
26
|
-
jest.mock("../src/STSClient", () => ({
|
|
27
|
-
STSClient: function (params: any) {
|
|
28
|
-
mockConstructorInput(params);
|
|
29
|
-
//@ts-ignore
|
|
30
|
-
return new (jest.requireActual("../src/STSClient").STSClient)(params);
|
|
31
|
-
},
|
|
32
|
-
}));
|
|
33
|
-
|
|
34
|
-
describe("getDefaultRoleAssumer", () => {
|
|
35
|
-
const assumeRoleResponse = `<AssumeRoleResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
|
|
36
|
-
<AssumeRoleResult>
|
|
37
|
-
<AssumedRoleUser>
|
|
38
|
-
<AssumedRoleId>AROAZOX2IL27GNRBJHWC2:session</AssumedRoleId>
|
|
39
|
-
<Arn>arn:aws:sts::123:assumed-role/assume-role-test/session</Arn>
|
|
40
|
-
</AssumedRoleUser>
|
|
41
|
-
<Credentials>
|
|
42
|
-
<AccessKeyId>key</AccessKeyId>
|
|
43
|
-
<SecretAccessKey>secrete</SecretAccessKey>
|
|
44
|
-
<SessionToken>session-token</SessionToken>
|
|
45
|
-
<Expiration>2021-05-05T23:22:08Z</Expiration>
|
|
46
|
-
</Credentials>
|
|
47
|
-
</AssumeRoleResult>
|
|
48
|
-
<ResponseMetadata>
|
|
49
|
-
<RequestId>12345678id</RequestId>
|
|
50
|
-
</ResponseMetadata>
|
|
51
|
-
</AssumeRoleResponse>`;
|
|
52
|
-
|
|
53
|
-
beforeAll(() => {
|
|
54
|
-
(streamCollector as jest.Mock).mockImplementation(async () => Buffer.from(assumeRoleResponse));
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
beforeEach(() => {
|
|
58
|
-
jest.clearAllMocks();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it("should use supplied source credentials", async () => {
|
|
62
|
-
const roleAssumer = getDefaultRoleAssumer();
|
|
63
|
-
const params: AssumeRoleCommandInput = {
|
|
64
|
-
RoleArn: "arn:aws:foo",
|
|
65
|
-
RoleSessionName: "session",
|
|
66
|
-
};
|
|
67
|
-
const sourceCred1 = { accessKeyId: "key1", secretAccessKey: "secrete1" };
|
|
68
|
-
await roleAssumer(sourceCred1, params);
|
|
69
|
-
expect(mockHandle).toBeCalledTimes(1);
|
|
70
|
-
// Validate request is signed by sourceCred1
|
|
71
|
-
expect(mockHandle.mock.calls[0][0].headers?.authorization).toEqual(
|
|
72
|
-
expect.stringContaining("AWS4-HMAC-SHA256 Credential=key1/")
|
|
73
|
-
);
|
|
74
|
-
const sourceCred2 = { accessKeyId: "key2", secretAccessKey: "secrete1" };
|
|
75
|
-
await roleAssumer(sourceCred2, params);
|
|
76
|
-
// Validate request is signed by sourceCred2
|
|
77
|
-
expect(mockHandle).toBeCalledTimes(2);
|
|
78
|
-
expect(mockHandle.mock.calls[1][0].headers?.authorization).toEqual(
|
|
79
|
-
expect.stringContaining("AWS4-HMAC-SHA256 Credential=key2/")
|
|
80
|
-
);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it("should use the STS client config", async () => {
|
|
84
|
-
const logger = console;
|
|
85
|
-
const region = "some-region";
|
|
86
|
-
const handler = new NodeHttpHandler();
|
|
87
|
-
const roleAssumer = getDefaultRoleAssumer({
|
|
88
|
-
region,
|
|
89
|
-
logger,
|
|
90
|
-
requestHandler: handler,
|
|
91
|
-
});
|
|
92
|
-
const params: AssumeRoleCommandInput = {
|
|
93
|
-
RoleArn: "arn:aws:foo",
|
|
94
|
-
RoleSessionName: "session",
|
|
95
|
-
};
|
|
96
|
-
const sourceCred = { accessKeyId: "key", secretAccessKey: "secrete" };
|
|
97
|
-
await roleAssumer(sourceCred, params);
|
|
98
|
-
expect(mockConstructorInput).toHaveBeenCalledTimes(1);
|
|
99
|
-
expect(mockConstructorInput.mock.calls[0][0]).toMatchObject({
|
|
100
|
-
logger,
|
|
101
|
-
requestHandler: handler,
|
|
102
|
-
region,
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
describe("getDefaultRoleAssumerWithWebIdentity", () => {
|
|
108
|
-
const assumeRoleResponse = `<Response xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
|
|
109
|
-
<AssumeRoleWithWebIdentityResult>
|
|
110
|
-
<Credentials>
|
|
111
|
-
<AccessKeyId>key</AccessKeyId>
|
|
112
|
-
<SecretAccessKey>secrete</SecretAccessKey>
|
|
113
|
-
<SessionToken>session-token</SessionToken>
|
|
114
|
-
<Expiration>2021-05-05T23:22:08Z</Expiration>
|
|
115
|
-
</Credentials>
|
|
116
|
-
</AssumeRoleWithWebIdentityResult>
|
|
117
|
-
</Response>`;
|
|
118
|
-
|
|
119
|
-
beforeAll(() => {
|
|
120
|
-
(streamCollector as jest.Mock).mockImplementation(async () => Buffer.from(assumeRoleResponse));
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
beforeEach(() => {
|
|
124
|
-
jest.clearAllMocks();
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it("should use the STS client config", async () => {
|
|
128
|
-
const logger = console;
|
|
129
|
-
const region = "some-region";
|
|
130
|
-
const handler = new NodeHttpHandler();
|
|
131
|
-
const roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({
|
|
132
|
-
region,
|
|
133
|
-
logger,
|
|
134
|
-
requestHandler: handler,
|
|
135
|
-
});
|
|
136
|
-
const params: AssumeRoleWithWebIdentityCommandInput = {
|
|
137
|
-
RoleArn: "arn:aws:foo",
|
|
138
|
-
RoleSessionName: "session",
|
|
139
|
-
WebIdentityToken: "token",
|
|
140
|
-
};
|
|
141
|
-
await roleAssumerWithWebIdentity(params);
|
|
142
|
-
expect(mockConstructorInput).toHaveBeenCalledTimes(1);
|
|
143
|
-
expect(mockConstructorInput.mock.calls[0][0]).toMatchObject({
|
|
144
|
-
logger,
|
|
145
|
-
requestHandler: handler,
|
|
146
|
-
region,
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
});
|
package/tsconfig.es.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"module": "esnext",
|
|
6
|
-
"moduleResolution": "node",
|
|
7
|
-
"lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"],
|
|
8
|
-
"outDir": "dist-es"
|
|
9
|
-
}
|
|
10
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"alwaysStrict": true,
|
|
4
|
-
"target": "ES2018",
|
|
5
|
-
"module": "commonjs",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"sourceMap": true,
|
|
8
|
-
"downlevelIteration": true,
|
|
9
|
-
"importHelpers": true,
|
|
10
|
-
"noEmitHelpers": true,
|
|
11
|
-
"incremental": true,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"esModuleInterop": true,
|
|
14
|
-
"rootDir": "src",
|
|
15
|
-
"outDir": "dist-cjs",
|
|
16
|
-
"removeComments": true
|
|
17
|
-
},
|
|
18
|
-
"typedocOptions": {
|
|
19
|
-
"exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"],
|
|
20
|
-
"excludeNotExported": true,
|
|
21
|
-
"excludePrivate": true,
|
|
22
|
-
"hideGenerator": true,
|
|
23
|
-
"ignoreCompilerErrors": true,
|
|
24
|
-
"includeDeclarations": true,
|
|
25
|
-
"stripInternal": true,
|
|
26
|
-
"readme": "README.md",
|
|
27
|
-
"mode": "file",
|
|
28
|
-
"out": "docs",
|
|
29
|
-
"theme": "minimal",
|
|
30
|
-
"plugin": ["@aws-sdk/client-documentation-generator"]
|
|
31
|
-
},
|
|
32
|
-
"exclude": ["test/**/*"]
|
|
33
|
-
}
|