@aws-sdk/credential-providers 3.1075.0 → 3.1077.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/dist-cjs/index.js CHANGED
@@ -1,17 +1,243 @@
1
- var __exportStar = (m, e) => { Object.assign(e, m); };
2
- __exportStar(require("./createCredentialChain"), exports);
3
- __exportStar(require("./fromCognitoIdentity"), exports);
4
- __exportStar(require("./fromCognitoIdentityPool"), exports);
5
- __exportStar(require("./fromContainerMetadata"), exports);
6
- __exportStar(require("./fromEnv"), exports);
1
+ const { ProviderError, CredentialsProviderError, loadConfig, NODE_REGION_CONFIG_FILE_OPTIONS } = require("@smithy/core/config");
2
+ const { fromCognitoIdentity: fromCognitoIdentity$1, fromCognitoIdentityPool: fromCognitoIdentityPool$1 } = require("@aws-sdk/credential-provider-cognito-identity");
3
+ const { fromContainerMetadata: fromContainerMetadata$1, fromInstanceMetadata: fromInstanceMetadata$1 } = require("@smithy/credential-provider-imds");
4
+ const { fromEnv: fromEnv$1 } = require("@aws-sdk/credential-provider-env");
7
5
  const { fromHttp } = require("@aws-sdk/credential-provider-http");
8
6
  exports.fromHttp = fromHttp;
9
- __exportStar(require("./fromIni"), exports);
10
- __exportStar(require("./fromInstanceMetadata"), exports);
11
- __exportStar(require("./fromLoginCredentials"), exports);
12
- __exportStar(require("./fromNodeProviderChain"), exports);
13
- __exportStar(require("./fromProcess"), exports);
14
- __exportStar(require("./fromSSO"), exports);
15
- __exportStar(require("./fromTemporaryCredentials"), exports);
16
- __exportStar(require("./fromTokenFile"), exports);
17
- __exportStar(require("./fromWebToken"), exports);
7
+ const { fromIni: fromIni$1 } = require("@aws-sdk/credential-provider-ini");
8
+ const { setCredentialFeature } = require("@aws-sdk/core/client");
9
+ const { fromLoginCredentials: fromLoginCredentials$1 } = require("@aws-sdk/credential-provider-login");
10
+ const { defaultProvider } = require("@aws-sdk/credential-provider-node");
11
+ const { fromProcess: fromProcess$1 } = require("@aws-sdk/credential-provider-process");
12
+ const { fromSSO: fromSSO$1 } = require("@aws-sdk/credential-provider-sso");
13
+ const { normalizeProvider } = require("@smithy/core");
14
+ const { fromTokenFile: fromTokenFile$1, fromWebToken: fromWebToken$1 } = require("@aws-sdk/credential-provider-web-identity");
15
+
16
+ const createCredentialChain = (...credentialProviders) => {
17
+ let expireAfter = -1;
18
+ const baseFunction = async (awsIdentityProperties) => {
19
+ const credentials = await propertyProviderChain(...credentialProviders)(awsIdentityProperties);
20
+ if (!credentials.expiration && expireAfter !== -1) {
21
+ credentials.expiration = new Date(Date.now() + expireAfter);
22
+ }
23
+ return credentials;
24
+ };
25
+ const withOptions = Object.assign(baseFunction, {
26
+ expireAfter(milliseconds) {
27
+ if (milliseconds < 5 * 60_000) {
28
+ throw new Error("@aws-sdk/credential-providers - createCredentialChain(...).expireAfter(ms) may not be called with a duration lower than five minutes.");
29
+ }
30
+ expireAfter = milliseconds;
31
+ return withOptions;
32
+ },
33
+ });
34
+ return withOptions;
35
+ };
36
+ const propertyProviderChain = (...providers) => async (awsIdentityProperties) => {
37
+ if (providers.length === 0) {
38
+ throw new ProviderError("No providers in chain", { tryNextLink: false });
39
+ }
40
+ let lastProviderError;
41
+ for (const provider of providers) {
42
+ try {
43
+ return await provider(awsIdentityProperties);
44
+ }
45
+ catch (err) {
46
+ lastProviderError = err;
47
+ if (err?.tryNextLink) {
48
+ continue;
49
+ }
50
+ throw err;
51
+ }
52
+ }
53
+ throw lastProviderError;
54
+ };
55
+
56
+ const fromCognitoIdentity = (options) => fromCognitoIdentity$1({
57
+ ...options,
58
+ });
59
+
60
+ const fromCognitoIdentityPool = (options) => fromCognitoIdentityPool$1({
61
+ ...options,
62
+ });
63
+
64
+ const fromContainerMetadata = (init) => {
65
+ init?.logger?.debug("@smithy/credential-provider-imds", "fromContainerMetadata");
66
+ return fromContainerMetadata$1(init);
67
+ };
68
+
69
+ const fromEnv = (init) => fromEnv$1(init);
70
+
71
+ const fromIni = (init = {}) => fromIni$1({
72
+ ...init,
73
+ });
74
+
75
+ const fromInstanceMetadata = (init) => {
76
+ init?.logger?.debug("@smithy/credential-provider-imds", "fromInstanceMetadata");
77
+ return async () => fromInstanceMetadata$1(init)().then((creds) => setCredentialFeature(creds, "CREDENTIALS_IMDS", "0"));
78
+ };
79
+
80
+ const fromLoginCredentials = (init) => fromLoginCredentials$1({
81
+ ...init,
82
+ });
83
+
84
+ const fromNodeProviderChain = (init = {}) => defaultProvider({
85
+ ...init,
86
+ });
87
+
88
+ const fromProcess = (init) => fromProcess$1(init);
89
+
90
+ const fromSSO = (init = {}) => {
91
+ return fromSSO$1({ ...init });
92
+ };
93
+
94
+ const ASSUME_ROLE_DEFAULT_REGION = "us-east-1";
95
+ const fromTemporaryCredentials$1 = (options, credentialDefaultProvider, regionProvider) => {
96
+ let stsClient;
97
+ return async (awsIdentityProperties = {}) => {
98
+ const { callerClientConfig } = awsIdentityProperties;
99
+ const profile = options.clientConfig?.profile ?? callerClientConfig?.profile;
100
+ const logger = options.logger ?? callerClientConfig?.logger;
101
+ logger?.debug("@aws-sdk/credential-providers - fromTemporaryCredentials (STS)");
102
+ const params = { ...options.params, RoleSessionName: options.params.RoleSessionName ?? "aws-sdk-js-" + Date.now() };
103
+ if (params?.SerialNumber) {
104
+ if (!options.mfaCodeProvider) {
105
+ throw new CredentialsProviderError(`Temporary credential requires multi-factor authentication, but no MFA code callback was provided.`, {
106
+ tryNextLink: false,
107
+ logger,
108
+ });
109
+ }
110
+ params.TokenCode = await options.mfaCodeProvider(params?.SerialNumber);
111
+ }
112
+ const { AssumeRoleCommand, STSClient } = require('./loadSts-C4jOcYxJ.js');
113
+ if (!stsClient) {
114
+ const defaultCredentialsOrError = typeof credentialDefaultProvider === "function" ? credentialDefaultProvider() : undefined;
115
+ const credentialSources = [
116
+ options.masterCredentials,
117
+ options.clientConfig?.credentials,
118
+ void callerClientConfig?.credentials,
119
+ callerClientConfig?.credentialDefaultProvider?.(),
120
+ defaultCredentialsOrError,
121
+ ];
122
+ let credentialSource = "STS client default credentials";
123
+ if (credentialSources[0]) {
124
+ credentialSource = "options.masterCredentials";
125
+ }
126
+ else if (credentialSources[1]) {
127
+ credentialSource = "options.clientConfig.credentials";
128
+ }
129
+ else if (credentialSources[2]) {
130
+ credentialSource = "caller client's credentials";
131
+ throw new Error("fromTemporaryCredentials recursion in callerClientConfig.credentials");
132
+ }
133
+ else if (credentialSources[3]) {
134
+ credentialSource = "caller client's credentialDefaultProvider";
135
+ }
136
+ else if (credentialSources[4]) {
137
+ credentialSource = "AWS SDK default credentials";
138
+ }
139
+ const regionSources = [
140
+ options.clientConfig?.region,
141
+ callerClientConfig?.region,
142
+ await regionProvider?.({
143
+ profile,
144
+ }),
145
+ ASSUME_ROLE_DEFAULT_REGION,
146
+ ];
147
+ let regionSource = "default partition's default region";
148
+ if (regionSources[0]) {
149
+ regionSource = "options.clientConfig.region";
150
+ }
151
+ else if (regionSources[1]) {
152
+ regionSource = "caller client's region";
153
+ }
154
+ else if (regionSources[2]) {
155
+ regionSource = "file or env region";
156
+ }
157
+ const requestHandlerSources = [
158
+ filterRequestHandler(options.clientConfig?.requestHandler),
159
+ filterRequestHandler(callerClientConfig?.requestHandler),
160
+ ];
161
+ let requestHandlerSource = "STS default requestHandler";
162
+ if (requestHandlerSources[0]) {
163
+ requestHandlerSource = "options.clientConfig.requestHandler";
164
+ }
165
+ else if (requestHandlerSources[1]) {
166
+ requestHandlerSource = "caller client's requestHandler";
167
+ }
168
+ logger?.debug?.(`@aws-sdk/credential-providers - fromTemporaryCredentials STS client init with ` +
169
+ `${regionSource}=${await normalizeProvider(coalesce(regionSources))()}, ${credentialSource}, ${requestHandlerSource}.`);
170
+ stsClient = new STSClient({
171
+ userAgentAppId: callerClientConfig?.userAgentAppId,
172
+ ...options.clientConfig,
173
+ credentials: coalesce(credentialSources),
174
+ logger,
175
+ profile,
176
+ region: coalesce(regionSources),
177
+ requestHandler: coalesce(requestHandlerSources),
178
+ });
179
+ }
180
+ if (options.clientPlugins) {
181
+ for (const plugin of options.clientPlugins) {
182
+ stsClient.middlewareStack.use(plugin);
183
+ }
184
+ }
185
+ const { Credentials } = await stsClient.send(new AssumeRoleCommand(params));
186
+ if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
187
+ throw new CredentialsProviderError(`Invalid response from STS.assumeRole call with role ${params.RoleArn}`, {
188
+ logger,
189
+ });
190
+ }
191
+ return {
192
+ accessKeyId: Credentials.AccessKeyId,
193
+ secretAccessKey: Credentials.SecretAccessKey,
194
+ sessionToken: Credentials.SessionToken,
195
+ expiration: Credentials.Expiration,
196
+ credentialScope: Credentials.CredentialScope,
197
+ };
198
+ };
199
+ };
200
+ const filterRequestHandler = (requestHandler) => {
201
+ return requestHandler?.metadata?.handlerProtocol === "h2" ? undefined : requestHandler;
202
+ };
203
+ const coalesce = (args) => {
204
+ for (const item of args) {
205
+ if (item !== undefined) {
206
+ return item;
207
+ }
208
+ }
209
+ };
210
+
211
+ const fromTemporaryCredentials = (options) => {
212
+ return fromTemporaryCredentials$1(options, fromNodeProviderChain, async ({ profile = process.env.AWS_PROFILE }) => loadConfig({
213
+ environmentVariableSelector: (env) => env.AWS_REGION,
214
+ configFileSelector: (profileData) => {
215
+ return profileData.region;
216
+ },
217
+ default: () => undefined,
218
+ }, { ...NODE_REGION_CONFIG_FILE_OPTIONS, profile })());
219
+ };
220
+
221
+ const fromTokenFile = (init = {}) => fromTokenFile$1({
222
+ ...init,
223
+ });
224
+
225
+ const fromWebToken = (init) => fromWebToken$1({
226
+ ...init,
227
+ });
228
+
229
+ exports.createCredentialChain = createCredentialChain;
230
+ exports.fromCognitoIdentity = fromCognitoIdentity;
231
+ exports.fromCognitoIdentityPool = fromCognitoIdentityPool;
232
+ exports.fromContainerMetadata = fromContainerMetadata;
233
+ exports.fromEnv = fromEnv;
234
+ exports.fromIni = fromIni;
235
+ exports.fromInstanceMetadata = fromInstanceMetadata;
236
+ exports.fromLoginCredentials = fromLoginCredentials;
237
+ exports.fromNodeProviderChain = fromNodeProviderChain;
238
+ exports.fromProcess = fromProcess;
239
+ exports.fromSSO = fromSSO;
240
+ exports.fromTemporaryCredentials = fromTemporaryCredentials;
241
+ exports.fromTokenFile = fromTokenFile;
242
+ exports.fromWebToken = fromWebToken;
243
+ exports.propertyProviderChain = propertyProviderChain;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/credential-providers",
3
- "version": "3.1075.0",
3
+ "version": "3.1077.0",
4
4
  "description": "A collection of credential providers, without requiring service clients like STS, Cognito",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -10,9 +10,7 @@
10
10
  },
11
11
  "react-native": {
12
12
  "./dist-es/fromTemporaryCredentials": "./dist-es/fromTemporaryCredentials.browser",
13
- "./dist-cjs/fromTemporaryCredentials": "./dist-cjs/fromTemporaryCredentials.browser",
14
- "./dist-es/index": "./dist-es/index.browser",
15
- "./dist-cjs/index": "./dist-cjs/index.browser"
13
+ "./dist-es/index": "./dist-es/index.browser"
16
14
  },
17
15
  "scripts": {
18
16
  "build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
@@ -39,22 +37,22 @@
39
37
  },
40
38
  "license": "Apache-2.0",
41
39
  "dependencies": {
42
- "@aws-sdk/client-cognito-identity": "3.1075.0",
43
- "@aws-sdk/core": "^3.974.23",
44
- "@aws-sdk/credential-provider-cognito-identity": "^3.972.48",
45
- "@aws-sdk/credential-provider-env": "^3.972.49",
46
- "@aws-sdk/credential-provider-http": "^3.972.51",
47
- "@aws-sdk/credential-provider-ini": "^3.972.56",
48
- "@aws-sdk/credential-provider-login": "^3.972.55",
49
- "@aws-sdk/credential-provider-node": "^3.972.58",
50
- "@aws-sdk/credential-provider-process": "^3.972.49",
51
- "@aws-sdk/credential-provider-sso": "^3.972.55",
52
- "@aws-sdk/credential-provider-web-identity": "^3.972.55",
53
- "@aws-sdk/nested-clients": "^3.997.23",
54
- "@aws-sdk/types": "^3.973.13",
55
- "@smithy/core": "^3.24.6",
56
- "@smithy/credential-provider-imds": "^4.3.7",
57
- "@smithy/types": "^4.14.3",
40
+ "@aws-sdk/client-cognito-identity": "3.1077.0",
41
+ "@aws-sdk/core": "^3.974.25",
42
+ "@aws-sdk/credential-provider-cognito-identity": "^3.972.50",
43
+ "@aws-sdk/credential-provider-env": "^3.972.51",
44
+ "@aws-sdk/credential-provider-http": "^3.972.53",
45
+ "@aws-sdk/credential-provider-ini": "^3.972.58",
46
+ "@aws-sdk/credential-provider-login": "^3.972.57",
47
+ "@aws-sdk/credential-provider-node": "^3.972.60",
48
+ "@aws-sdk/credential-provider-process": "^3.972.51",
49
+ "@aws-sdk/credential-provider-sso": "^3.972.57",
50
+ "@aws-sdk/credential-provider-web-identity": "^3.972.57",
51
+ "@aws-sdk/nested-clients": "^3.997.25",
52
+ "@aws-sdk/types": "^3.973.14",
53
+ "@smithy/core": "^3.28.0",
54
+ "@smithy/credential-provider-imds": "^4.4.4",
55
+ "@smithy/types": "^4.15.0",
58
56
  "tslib": "^2.6.2"
59
57
  },
60
58
  "devDependencies": {
@@ -1,41 +0,0 @@
1
- const { ProviderError } = require("@smithy/core/config");
2
- exports.createCredentialChain = (...credentialProviders) => {
3
- let expireAfter = -1;
4
- const baseFunction = async (awsIdentityProperties) => {
5
- const credentials = await propertyProviderChain(...credentialProviders)(awsIdentityProperties);
6
- if (!credentials.expiration && expireAfter !== -1) {
7
- credentials.expiration = new Date(Date.now() + expireAfter);
8
- }
9
- return credentials;
10
- };
11
- const withOptions = Object.assign(baseFunction, {
12
- expireAfter(milliseconds) {
13
- if (milliseconds < 5 * 60_000) {
14
- throw new Error("@aws-sdk/credential-providers - createCredentialChain(...).expireAfter(ms) may not be called with a duration lower than five minutes.");
15
- }
16
- expireAfter = milliseconds;
17
- return withOptions;
18
- },
19
- });
20
- return withOptions;
21
- };
22
- const propertyProviderChain = (...providers) => async (awsIdentityProperties) => {
23
- if (providers.length === 0) {
24
- throw new ProviderError("No providers in chain", { tryNextLink: false });
25
- }
26
- let lastProviderError;
27
- for (const provider of providers) {
28
- try {
29
- return await provider(awsIdentityProperties);
30
- }
31
- catch (err) {
32
- lastProviderError = err;
33
- if (err?.tryNextLink) {
34
- continue;
35
- }
36
- throw err;
37
- }
38
- }
39
- throw lastProviderError;
40
- };
41
- exports.propertyProviderChain = propertyProviderChain;
@@ -1,5 +0,0 @@
1
- const { fromCognitoIdentity: _fromCognitoIdentity } = require("@aws-sdk/credential-provider-cognito-identity");
2
- const fromCognitoIdentity = (options) => _fromCognitoIdentity({
3
- ...options,
4
- });
5
- exports.fromCognitoIdentity = fromCognitoIdentity;
@@ -1,5 +0,0 @@
1
- const { fromCognitoIdentityPool: _fromCognitoIdentityPool } = require("@aws-sdk/credential-provider-cognito-identity");
2
- const fromCognitoIdentityPool = (options) => _fromCognitoIdentityPool({
3
- ...options,
4
- });
5
- exports.fromCognitoIdentityPool = fromCognitoIdentityPool;
@@ -1,6 +0,0 @@
1
- const { fromContainerMetadata: _fromContainerMetadata } = require("@smithy/credential-provider-imds");
2
- const fromContainerMetadata = (init) => {
3
- init?.logger?.debug("@smithy/credential-provider-imds", "fromContainerMetadata");
4
- return _fromContainerMetadata(init);
5
- };
6
- exports.fromContainerMetadata = fromContainerMetadata;
@@ -1,3 +0,0 @@
1
- const { fromEnv: _fromEnv } = require("@aws-sdk/credential-provider-env");
2
- const fromEnv = (init) => _fromEnv(init);
3
- exports.fromEnv = fromEnv;
@@ -1,5 +0,0 @@
1
- const { fromIni: _fromIni } = require("@aws-sdk/credential-provider-ini");
2
- const fromIni = (init = {}) => _fromIni({
3
- ...init,
4
- });
5
- exports.fromIni = fromIni;
@@ -1,7 +0,0 @@
1
- const { setCredentialFeature } = require("@aws-sdk/core/client");
2
- const { fromInstanceMetadata: _fromInstanceMetadata } = require("@smithy/credential-provider-imds");
3
- const fromInstanceMetadata = (init) => {
4
- init?.logger?.debug("@smithy/credential-provider-imds", "fromInstanceMetadata");
5
- return async () => _fromInstanceMetadata(init)().then((creds) => setCredentialFeature(creds, "CREDENTIALS_IMDS", "0"));
6
- };
7
- exports.fromInstanceMetadata = fromInstanceMetadata;
@@ -1,5 +0,0 @@
1
- const { fromLoginCredentials: _fromLoginCredentials } = require("@aws-sdk/credential-provider-login");
2
- const fromLoginCredentials = (init) => _fromLoginCredentials({
3
- ...init,
4
- });
5
- exports.fromLoginCredentials = fromLoginCredentials;
@@ -1,4 +0,0 @@
1
- const { defaultProvider } = require("@aws-sdk/credential-provider-node");
2
- exports.fromNodeProviderChain = (init = {}) => defaultProvider({
3
- ...init,
4
- });
@@ -1,3 +0,0 @@
1
- const { fromProcess: _fromProcess } = require("@aws-sdk/credential-provider-process");
2
- const fromProcess = (init) => _fromProcess(init);
3
- exports.fromProcess = fromProcess;
@@ -1,5 +0,0 @@
1
- const { fromSSO: _fromSSO } = require("@aws-sdk/credential-provider-sso");
2
- const fromSSO = (init = {}) => {
3
- return _fromSSO({ ...init });
4
- };
5
- exports.fromSSO = fromSSO;
@@ -1,118 +0,0 @@
1
- const { normalizeProvider } = require("@smithy/core");
2
- const { CredentialsProviderError } = require("@smithy/core/config");
3
- const ASSUME_ROLE_DEFAULT_REGION = "us-east-1";
4
- exports.fromTemporaryCredentials = (options, credentialDefaultProvider, regionProvider) => {
5
- let stsClient;
6
- return async (awsIdentityProperties = {}) => {
7
- const { callerClientConfig } = awsIdentityProperties;
8
- const profile = options.clientConfig?.profile ?? callerClientConfig?.profile;
9
- const logger = options.logger ?? callerClientConfig?.logger;
10
- logger?.debug("@aws-sdk/credential-providers - fromTemporaryCredentials (STS)");
11
- const params = { ...options.params, RoleSessionName: options.params.RoleSessionName ?? "aws-sdk-js-" + Date.now() };
12
- if (params?.SerialNumber) {
13
- if (!options.mfaCodeProvider) {
14
- throw new CredentialsProviderError(`Temporary credential requires multi-factor authentication, but no MFA code callback was provided.`, {
15
- tryNextLink: false,
16
- logger,
17
- });
18
- }
19
- params.TokenCode = await options.mfaCodeProvider(params?.SerialNumber);
20
- }
21
- const { AssumeRoleCommand, STSClient } = require("./loadSts.js");
22
- if (!stsClient) {
23
- const defaultCredentialsOrError = typeof credentialDefaultProvider === "function" ? credentialDefaultProvider() : undefined;
24
- const credentialSources = [
25
- options.masterCredentials,
26
- options.clientConfig?.credentials,
27
- void callerClientConfig?.credentials,
28
- callerClientConfig?.credentialDefaultProvider?.(),
29
- defaultCredentialsOrError,
30
- ];
31
- let credentialSource = "STS client default credentials";
32
- if (credentialSources[0]) {
33
- credentialSource = "options.masterCredentials";
34
- }
35
- else if (credentialSources[1]) {
36
- credentialSource = "options.clientConfig.credentials";
37
- }
38
- else if (credentialSources[2]) {
39
- credentialSource = "caller client's credentials";
40
- throw new Error("fromTemporaryCredentials recursion in callerClientConfig.credentials");
41
- }
42
- else if (credentialSources[3]) {
43
- credentialSource = "caller client's credentialDefaultProvider";
44
- }
45
- else if (credentialSources[4]) {
46
- credentialSource = "AWS SDK default credentials";
47
- }
48
- const regionSources = [
49
- options.clientConfig?.region,
50
- callerClientConfig?.region,
51
- await regionProvider?.({
52
- profile,
53
- }),
54
- ASSUME_ROLE_DEFAULT_REGION,
55
- ];
56
- let regionSource = "default partition's default region";
57
- if (regionSources[0]) {
58
- regionSource = "options.clientConfig.region";
59
- }
60
- else if (regionSources[1]) {
61
- regionSource = "caller client's region";
62
- }
63
- else if (regionSources[2]) {
64
- regionSource = "file or env region";
65
- }
66
- const requestHandlerSources = [
67
- filterRequestHandler(options.clientConfig?.requestHandler),
68
- filterRequestHandler(callerClientConfig?.requestHandler),
69
- ];
70
- let requestHandlerSource = "STS default requestHandler";
71
- if (requestHandlerSources[0]) {
72
- requestHandlerSource = "options.clientConfig.requestHandler";
73
- }
74
- else if (requestHandlerSources[1]) {
75
- requestHandlerSource = "caller client's requestHandler";
76
- }
77
- logger?.debug?.(`@aws-sdk/credential-providers - fromTemporaryCredentials STS client init with ` +
78
- `${regionSource}=${await normalizeProvider(coalesce(regionSources))()}, ${credentialSource}, ${requestHandlerSource}.`);
79
- stsClient = new STSClient({
80
- userAgentAppId: callerClientConfig?.userAgentAppId,
81
- ...options.clientConfig,
82
- credentials: coalesce(credentialSources),
83
- logger,
84
- profile,
85
- region: coalesce(regionSources),
86
- requestHandler: coalesce(requestHandlerSources),
87
- });
88
- }
89
- if (options.clientPlugins) {
90
- for (const plugin of options.clientPlugins) {
91
- stsClient.middlewareStack.use(plugin);
92
- }
93
- }
94
- const { Credentials } = await stsClient.send(new AssumeRoleCommand(params));
95
- if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
96
- throw new CredentialsProviderError(`Invalid response from STS.assumeRole call with role ${params.RoleArn}`, {
97
- logger,
98
- });
99
- }
100
- return {
101
- accessKeyId: Credentials.AccessKeyId,
102
- secretAccessKey: Credentials.SecretAccessKey,
103
- sessionToken: Credentials.SessionToken,
104
- expiration: Credentials.Expiration,
105
- credentialScope: Credentials.CredentialScope,
106
- };
107
- };
108
- };
109
- const filterRequestHandler = (requestHandler) => {
110
- return requestHandler?.metadata?.handlerProtocol === "h2" ? undefined : requestHandler;
111
- };
112
- const coalesce = (args) => {
113
- for (const item of args) {
114
- if (item !== undefined) {
115
- return item;
116
- }
117
- }
118
- };
@@ -1,2 +0,0 @@
1
- const { fromTemporaryCredentials } = require("./fromTemporaryCredentials.base");
2
- exports.fromTemporaryCredentials = fromTemporaryCredentials;
@@ -1,13 +0,0 @@
1
- const { loadConfig, NODE_REGION_CONFIG_FILE_OPTIONS } = require("@smithy/core/config");
2
- const { fromNodeProviderChain } = require("./fromNodeProviderChain");
3
- const { fromTemporaryCredentials: fromTemporaryCredentialsBase } = require("./fromTemporaryCredentials.base");
4
- const fromTemporaryCredentials = (options) => {
5
- return fromTemporaryCredentialsBase(options, fromNodeProviderChain, async ({ profile = process.env.AWS_PROFILE }) => loadConfig({
6
- environmentVariableSelector: (env) => env.AWS_REGION,
7
- configFileSelector: (profileData) => {
8
- return profileData.region;
9
- },
10
- default: () => undefined,
11
- }, { ...NODE_REGION_CONFIG_FILE_OPTIONS, profile })());
12
- };
13
- exports.fromTemporaryCredentials = fromTemporaryCredentials;
@@ -1,5 +0,0 @@
1
- const { fromTokenFile: _fromTokenFile } = require("@aws-sdk/credential-provider-web-identity");
2
- const fromTokenFile = (init = {}) => _fromTokenFile({
3
- ...init,
4
- });
5
- exports.fromTokenFile = fromTokenFile;
@@ -1,5 +0,0 @@
1
- const { fromWebToken: _fromWebToken } = require("@aws-sdk/credential-provider-web-identity");
2
- const fromWebToken = (init) => _fromWebToken({
3
- ...init,
4
- });
5
- exports.fromWebToken = fromWebToken;
@@ -1,7 +0,0 @@
1
- var __exportStar = (m, e) => { Object.assign(e, m); };
2
- __exportStar(require("./fromCognitoIdentity"), exports);
3
- __exportStar(require("./fromCognitoIdentityPool"), exports);
4
- const { fromHttp } = require("@aws-sdk/credential-provider-http");
5
- exports.fromHttp = fromHttp;
6
- __exportStar(require("./fromTemporaryCredentials.browser"), exports);
7
- __exportStar(require("./fromWebToken"), exports);
File without changes