@aws-sdk/credential-providers 3.775.0 → 3.778.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/fromTemporaryCredentials.base.js +14 -3
- package/dist-cjs/fromTemporaryCredentials.js +9 -1
- package/dist-es/fromTemporaryCredentials.base.js +14 -3
- package/dist-es/fromTemporaryCredentials.js +9 -1
- package/dist-types/fromTemporaryCredentials.base.d.ts +3 -1
- package/dist-types/ts3.4/fromTemporaryCredentials.base.d.ts +8 -1
- package/package.json +11 -9
|
@@ -27,10 +27,11 @@ exports.fromTemporaryCredentials = void 0;
|
|
|
27
27
|
const core_1 = require("@smithy/core");
|
|
28
28
|
const property_provider_1 = require("@smithy/property-provider");
|
|
29
29
|
const ASSUME_ROLE_DEFAULT_REGION = "us-east-1";
|
|
30
|
-
const fromTemporaryCredentials = (options, credentialDefaultProvider) => {
|
|
30
|
+
const fromTemporaryCredentials = (options, credentialDefaultProvider, regionProvider) => {
|
|
31
31
|
let stsClient;
|
|
32
32
|
return async (awsIdentityProperties = {}) => {
|
|
33
33
|
const { callerClientConfig } = awsIdentityProperties;
|
|
34
|
+
const profile = options.clientConfig?.profile ?? callerClientConfig?.profile;
|
|
34
35
|
const logger = options.logger ?? callerClientConfig?.logger;
|
|
35
36
|
logger?.debug("@aws-sdk/credential-providers - fromTemporaryCredentials (STS)");
|
|
36
37
|
const params = { ...options.params, RoleSessionName: options.params.RoleSessionName ?? "aws-sdk-js-" + Date.now() };
|
|
@@ -70,7 +71,14 @@ const fromTemporaryCredentials = (options, credentialDefaultProvider) => {
|
|
|
70
71
|
else if (credentialSources[4]) {
|
|
71
72
|
credentialSource = "AWS SDK default credentials";
|
|
72
73
|
}
|
|
73
|
-
const regionSources = [
|
|
74
|
+
const regionSources = [
|
|
75
|
+
options.clientConfig?.region,
|
|
76
|
+
callerClientConfig?.region,
|
|
77
|
+
await regionProvider?.({
|
|
78
|
+
profile,
|
|
79
|
+
}),
|
|
80
|
+
ASSUME_ROLE_DEFAULT_REGION,
|
|
81
|
+
];
|
|
74
82
|
let regionSource = "default partition's default region";
|
|
75
83
|
if (regionSources[0]) {
|
|
76
84
|
regionSource = "options.clientConfig.region";
|
|
@@ -78,6 +86,9 @@ const fromTemporaryCredentials = (options, credentialDefaultProvider) => {
|
|
|
78
86
|
else if (regionSources[1]) {
|
|
79
87
|
regionSource = "caller client's region";
|
|
80
88
|
}
|
|
89
|
+
else if (regionSources[2]) {
|
|
90
|
+
regionSource = "file or env region";
|
|
91
|
+
}
|
|
81
92
|
const requestHandlerSources = [
|
|
82
93
|
filterRequestHandler(options.clientConfig?.requestHandler),
|
|
83
94
|
filterRequestHandler(callerClientConfig?.requestHandler),
|
|
@@ -95,7 +106,7 @@ const fromTemporaryCredentials = (options, credentialDefaultProvider) => {
|
|
|
95
106
|
...options.clientConfig,
|
|
96
107
|
credentials: coalesce(credentialSources),
|
|
97
108
|
logger,
|
|
98
|
-
profile
|
|
109
|
+
profile,
|
|
99
110
|
region: coalesce(regionSources),
|
|
100
111
|
requestHandler: coalesce(requestHandlerSources),
|
|
101
112
|
});
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fromTemporaryCredentials = void 0;
|
|
4
|
+
const config_resolver_1 = require("@smithy/config-resolver");
|
|
5
|
+
const node_config_provider_1 = require("@smithy/node-config-provider");
|
|
4
6
|
const fromNodeProviderChain_1 = require("./fromNodeProviderChain");
|
|
5
7
|
const fromTemporaryCredentials_base_1 = require("./fromTemporaryCredentials.base");
|
|
6
8
|
const fromTemporaryCredentials = (options) => {
|
|
7
|
-
return (0, fromTemporaryCredentials_base_1.fromTemporaryCredentials)(options, fromNodeProviderChain_1.fromNodeProviderChain)
|
|
9
|
+
return (0, fromTemporaryCredentials_base_1.fromTemporaryCredentials)(options, fromNodeProviderChain_1.fromNodeProviderChain, async ({ profile = process.env.AWS_PROFILE }) => (0, node_config_provider_1.loadConfig)({
|
|
10
|
+
environmentVariableSelector: (env) => env.AWS_REGION,
|
|
11
|
+
configFileSelector: (profileData) => {
|
|
12
|
+
return profileData.region;
|
|
13
|
+
},
|
|
14
|
+
default: () => undefined,
|
|
15
|
+
}, { ...config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS, profile })());
|
|
8
16
|
};
|
|
9
17
|
exports.fromTemporaryCredentials = fromTemporaryCredentials;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { normalizeProvider } from "@smithy/core";
|
|
2
2
|
import { CredentialsProviderError } from "@smithy/property-provider";
|
|
3
3
|
const ASSUME_ROLE_DEFAULT_REGION = "us-east-1";
|
|
4
|
-
export const fromTemporaryCredentials = (options, credentialDefaultProvider) => {
|
|
4
|
+
export const fromTemporaryCredentials = (options, credentialDefaultProvider, regionProvider) => {
|
|
5
5
|
let stsClient;
|
|
6
6
|
return async (awsIdentityProperties = {}) => {
|
|
7
7
|
const { callerClientConfig } = awsIdentityProperties;
|
|
8
|
+
const profile = options.clientConfig?.profile ?? callerClientConfig?.profile;
|
|
8
9
|
const logger = options.logger ?? callerClientConfig?.logger;
|
|
9
10
|
logger?.debug("@aws-sdk/credential-providers - fromTemporaryCredentials (STS)");
|
|
10
11
|
const params = { ...options.params, RoleSessionName: options.params.RoleSessionName ?? "aws-sdk-js-" + Date.now() };
|
|
@@ -44,7 +45,14 @@ export const fromTemporaryCredentials = (options, credentialDefaultProvider) =>
|
|
|
44
45
|
else if (credentialSources[4]) {
|
|
45
46
|
credentialSource = "AWS SDK default credentials";
|
|
46
47
|
}
|
|
47
|
-
const regionSources = [
|
|
48
|
+
const regionSources = [
|
|
49
|
+
options.clientConfig?.region,
|
|
50
|
+
callerClientConfig?.region,
|
|
51
|
+
await regionProvider?.({
|
|
52
|
+
profile,
|
|
53
|
+
}),
|
|
54
|
+
ASSUME_ROLE_DEFAULT_REGION,
|
|
55
|
+
];
|
|
48
56
|
let regionSource = "default partition's default region";
|
|
49
57
|
if (regionSources[0]) {
|
|
50
58
|
regionSource = "options.clientConfig.region";
|
|
@@ -52,6 +60,9 @@ export const fromTemporaryCredentials = (options, credentialDefaultProvider) =>
|
|
|
52
60
|
else if (regionSources[1]) {
|
|
53
61
|
regionSource = "caller client's region";
|
|
54
62
|
}
|
|
63
|
+
else if (regionSources[2]) {
|
|
64
|
+
regionSource = "file or env region";
|
|
65
|
+
}
|
|
55
66
|
const requestHandlerSources = [
|
|
56
67
|
filterRequestHandler(options.clientConfig?.requestHandler),
|
|
57
68
|
filterRequestHandler(callerClientConfig?.requestHandler),
|
|
@@ -69,7 +80,7 @@ export const fromTemporaryCredentials = (options, credentialDefaultProvider) =>
|
|
|
69
80
|
...options.clientConfig,
|
|
70
81
|
credentials: coalesce(credentialSources),
|
|
71
82
|
logger,
|
|
72
|
-
profile
|
|
83
|
+
profile,
|
|
73
84
|
region: coalesce(regionSources),
|
|
74
85
|
requestHandler: coalesce(requestHandlerSources),
|
|
75
86
|
});
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import { NODE_REGION_CONFIG_FILE_OPTIONS } from "@smithy/config-resolver";
|
|
2
|
+
import { loadConfig } from "@smithy/node-config-provider";
|
|
1
3
|
import { fromNodeProviderChain } from "./fromNodeProviderChain";
|
|
2
4
|
import { fromTemporaryCredentials as fromTemporaryCredentialsBase } from "./fromTemporaryCredentials.base";
|
|
3
5
|
export const fromTemporaryCredentials = (options) => {
|
|
4
|
-
return fromTemporaryCredentialsBase(options, fromNodeProviderChain)
|
|
6
|
+
return fromTemporaryCredentialsBase(options, fromNodeProviderChain, async ({ profile = process.env.AWS_PROFILE }) => loadConfig({
|
|
7
|
+
environmentVariableSelector: (env) => env.AWS_REGION,
|
|
8
|
+
configFileSelector: (profileData) => {
|
|
9
|
+
return profileData.region;
|
|
10
|
+
},
|
|
11
|
+
default: () => undefined,
|
|
12
|
+
}, { ...NODE_REGION_CONFIG_FILE_OPTIONS, profile })());
|
|
5
13
|
};
|
|
@@ -11,4 +11,6 @@ export interface FromTemporaryCredentialsOptions extends CredentialProviderOptio
|
|
|
11
11
|
clientPlugins?: Pluggable<any, any>[];
|
|
12
12
|
mfaCodeProvider?: (mfaSerial: string) => Promise<string>;
|
|
13
13
|
}
|
|
14
|
-
export declare const fromTemporaryCredentials: (options: FromTemporaryCredentialsOptions, credentialDefaultProvider?: () => AwsCredentialIdentityProvider
|
|
14
|
+
export declare const fromTemporaryCredentials: (options: FromTemporaryCredentialsOptions, credentialDefaultProvider?: () => AwsCredentialIdentityProvider, regionProvider?: (({ profile }: {
|
|
15
|
+
profile?: string | undefined;
|
|
16
|
+
}) => Promise<string | undefined>) | undefined) => RuntimeConfigAwsCredentialIdentityProvider;
|
|
@@ -28,5 +28,12 @@ export interface FromTemporaryCredentialsOptions
|
|
|
28
28
|
}
|
|
29
29
|
export declare const fromTemporaryCredentials: (
|
|
30
30
|
options: FromTemporaryCredentialsOptions,
|
|
31
|
-
credentialDefaultProvider?: () => AwsCredentialIdentityProvider
|
|
31
|
+
credentialDefaultProvider?: () => AwsCredentialIdentityProvider,
|
|
32
|
+
regionProvider?:
|
|
33
|
+
| (({
|
|
34
|
+
profile,
|
|
35
|
+
}: {
|
|
36
|
+
profile?: string | undefined;
|
|
37
|
+
}) => Promise<string | undefined>)
|
|
38
|
+
| undefined
|
|
32
39
|
) => RuntimeConfigAwsCredentialIdentityProvider;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-providers",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.778.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",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
|
|
18
18
|
"extract:docs": "api-extractor run --local",
|
|
19
19
|
"test": "yarn g:vitest run",
|
|
20
|
-
"test:integration": "jest -c jest.config.integ.js",
|
|
20
|
+
"test:integration": "npx jest -c jest.config.integ.js",
|
|
21
21
|
"test:watch": "yarn g:vitest watch"
|
|
22
22
|
},
|
|
23
23
|
"keywords": [
|
|
@@ -30,20 +30,22 @@
|
|
|
30
30
|
},
|
|
31
31
|
"license": "Apache-2.0",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@aws-sdk/client-cognito-identity": "3.
|
|
33
|
+
"@aws-sdk/client-cognito-identity": "3.777.0",
|
|
34
34
|
"@aws-sdk/core": "3.775.0",
|
|
35
|
-
"@aws-sdk/credential-provider-cognito-identity": "3.
|
|
35
|
+
"@aws-sdk/credential-provider-cognito-identity": "3.777.0",
|
|
36
36
|
"@aws-sdk/credential-provider-env": "3.775.0",
|
|
37
37
|
"@aws-sdk/credential-provider-http": "3.775.0",
|
|
38
|
-
"@aws-sdk/credential-provider-ini": "3.
|
|
39
|
-
"@aws-sdk/credential-provider-node": "3.
|
|
38
|
+
"@aws-sdk/credential-provider-ini": "3.777.0",
|
|
39
|
+
"@aws-sdk/credential-provider-node": "3.777.0",
|
|
40
40
|
"@aws-sdk/credential-provider-process": "3.775.0",
|
|
41
|
-
"@aws-sdk/credential-provider-sso": "3.
|
|
42
|
-
"@aws-sdk/credential-provider-web-identity": "3.
|
|
43
|
-
"@aws-sdk/nested-clients": "3.
|
|
41
|
+
"@aws-sdk/credential-provider-sso": "3.777.0",
|
|
42
|
+
"@aws-sdk/credential-provider-web-identity": "3.777.0",
|
|
43
|
+
"@aws-sdk/nested-clients": "3.777.0",
|
|
44
44
|
"@aws-sdk/types": "3.775.0",
|
|
45
|
+
"@smithy/config-resolver": "^4.1.0",
|
|
45
46
|
"@smithy/core": "^3.2.0",
|
|
46
47
|
"@smithy/credential-provider-imds": "^4.0.2",
|
|
48
|
+
"@smithy/node-config-provider": "^4.0.2",
|
|
47
49
|
"@smithy/property-provider": "^4.0.2",
|
|
48
50
|
"@smithy/types": "^4.2.0",
|
|
49
51
|
"tslib": "^2.6.2"
|