@aws-sdk/client-sts 3.473.0 → 3.476.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/STSClient.js +17 -3
- package/dist-cjs/auth/httpAuthExtensionConfiguration.js +43 -0
- package/dist-cjs/auth/httpAuthSchemeProvider.js +67 -0
- package/dist-cjs/commands/AssumeRoleCommand.js +0 -2
- package/dist-cjs/commands/DecodeAuthorizationMessageCommand.js +0 -2
- package/dist-cjs/commands/GetAccessKeyInfoCommand.js +0 -2
- package/dist-cjs/commands/GetCallerIdentityCommand.js +0 -2
- package/dist-cjs/commands/GetFederationTokenCommand.js +0 -2
- package/dist-cjs/commands/GetSessionTokenCommand.js +0 -2
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/runtimeConfig.js +14 -0
- package/dist-cjs/runtimeConfig.shared.js +16 -0
- package/dist-cjs/runtimeExtensions.js +3 -0
- package/dist-es/STSClient.js +17 -3
- package/dist-es/auth/httpAuthExtensionConfiguration.js +38 -0
- package/dist-es/auth/httpAuthSchemeProvider.js +60 -0
- package/dist-es/commands/AssumeRoleCommand.js +0 -2
- package/dist-es/commands/DecodeAuthorizationMessageCommand.js +0 -2
- package/dist-es/commands/GetAccessKeyInfoCommand.js +0 -2
- package/dist-es/commands/GetCallerIdentityCommand.js +0 -2
- package/dist-es/commands/GetFederationTokenCommand.js +0 -2
- package/dist-es/commands/GetSessionTokenCommand.js +0 -2
- package/dist-es/index.js +1 -1
- package/dist-es/runtimeConfig.js +15 -1
- package/dist-es/runtimeConfig.shared.js +16 -0
- package/dist-es/runtimeExtensions.js +3 -0
- package/dist-types/STSClient.d.ts +13 -11
- package/dist-types/auth/httpAuthExtensionConfiguration.d.ts +29 -0
- package/dist-types/auth/httpAuthSchemeProvider.d.ts +71 -0
- package/dist-types/extensionConfiguration.d.ts +2 -1
- package/dist-types/index.d.ts +1 -1
- package/dist-types/runtimeConfig.browser.d.ts +15 -5
- package/dist-types/runtimeConfig.d.ts +13 -5
- package/dist-types/runtimeConfig.native.d.ts +16 -6
- package/dist-types/runtimeConfig.shared.d.ts +15 -2
- package/dist-types/ts3.4/STSClient.d.ts +11 -9
- package/dist-types/ts3.4/auth/httpAuthExtensionConfiguration.d.ts +32 -0
- package/dist-types/ts3.4/auth/httpAuthSchemeProvider.d.ts +54 -0
- package/dist-types/ts3.4/extensionConfiguration.d.ts +3 -1
- package/dist-types/ts3.4/index.d.ts +1 -1
- package/dist-types/ts3.4/runtimeConfig.browser.d.ts +36 -9
- package/dist-types/ts3.4/runtimeConfig.d.ts +27 -9
- package/dist-types/ts3.4/runtimeConfig.native.d.ts +39 -12
- package/dist-types/ts3.4/runtimeConfig.shared.d.ts +36 -4
- package/package.json +5 -5
package/dist-cjs/STSClient.js
CHANGED
|
@@ -4,18 +4,27 @@ exports.STSClient = exports.__Client = void 0;
|
|
|
4
4
|
const middleware_host_header_1 = require("@aws-sdk/middleware-host-header");
|
|
5
5
|
const middleware_logger_1 = require("@aws-sdk/middleware-logger");
|
|
6
6
|
const middleware_recursion_detection_1 = require("@aws-sdk/middleware-recursion-detection");
|
|
7
|
-
const middleware_sdk_sts_1 = require("@aws-sdk/middleware-sdk-sts");
|
|
8
7
|
const middleware_user_agent_1 = require("@aws-sdk/middleware-user-agent");
|
|
9
8
|
const config_resolver_1 = require("@smithy/config-resolver");
|
|
9
|
+
const core_1 = require("@smithy/core");
|
|
10
10
|
const middleware_content_length_1 = require("@smithy/middleware-content-length");
|
|
11
11
|
const middleware_endpoint_1 = require("@smithy/middleware-endpoint");
|
|
12
12
|
const middleware_retry_1 = require("@smithy/middleware-retry");
|
|
13
13
|
const smithy_client_1 = require("@smithy/smithy-client");
|
|
14
14
|
Object.defineProperty(exports, "__Client", { enumerable: true, get: function () { return smithy_client_1.Client; } });
|
|
15
|
+
const httpAuthSchemeProvider_1 = require("./auth/httpAuthSchemeProvider");
|
|
15
16
|
const EndpointParameters_1 = require("./endpoint/EndpointParameters");
|
|
16
17
|
const runtimeConfig_1 = require("./runtimeConfig");
|
|
17
18
|
const runtimeExtensions_1 = require("./runtimeExtensions");
|
|
18
19
|
class STSClient extends smithy_client_1.Client {
|
|
20
|
+
getDefaultHttpAuthSchemeParametersProvider() {
|
|
21
|
+
return httpAuthSchemeProvider_1.defaultSTSHttpAuthSchemeParametersProvider;
|
|
22
|
+
}
|
|
23
|
+
getIdentityProviderConfigProvider() {
|
|
24
|
+
return async (config) => new core_1.DefaultIdentityProviderConfig({
|
|
25
|
+
"aws.auth#sigv4": config.credentials,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
19
28
|
constructor(...[configuration]) {
|
|
20
29
|
const _config_0 = (0, runtimeConfig_1.getRuntimeConfig)(configuration || {});
|
|
21
30
|
const _config_1 = (0, EndpointParameters_1.resolveClientEndpointParameters)(_config_0);
|
|
@@ -23,8 +32,8 @@ class STSClient extends smithy_client_1.Client {
|
|
|
23
32
|
const _config_3 = (0, middleware_endpoint_1.resolveEndpointConfig)(_config_2);
|
|
24
33
|
const _config_4 = (0, middleware_retry_1.resolveRetryConfig)(_config_3);
|
|
25
34
|
const _config_5 = (0, middleware_host_header_1.resolveHostHeaderConfig)(_config_4);
|
|
26
|
-
const _config_6 = (0,
|
|
27
|
-
const _config_7 = (0,
|
|
35
|
+
const _config_6 = (0, middleware_user_agent_1.resolveUserAgentConfig)(_config_5);
|
|
36
|
+
const _config_7 = (0, httpAuthSchemeProvider_1.resolveHttpAuthSchemeConfig)(_config_6);
|
|
28
37
|
const _config_8 = (0, runtimeExtensions_1.resolveRuntimeExtensions)(_config_7, configuration?.extensions || []);
|
|
29
38
|
super(_config_8);
|
|
30
39
|
this.config = _config_8;
|
|
@@ -34,6 +43,11 @@ class STSClient extends smithy_client_1.Client {
|
|
|
34
43
|
this.middlewareStack.use((0, middleware_logger_1.getLoggerPlugin)(this.config));
|
|
35
44
|
this.middlewareStack.use((0, middleware_recursion_detection_1.getRecursionDetectionPlugin)(this.config));
|
|
36
45
|
this.middlewareStack.use((0, middleware_user_agent_1.getUserAgentPlugin)(this.config));
|
|
46
|
+
this.middlewareStack.use((0, core_1.getHttpAuthSchemeEndpointRuleSetPlugin)(this.config, {
|
|
47
|
+
httpAuthSchemeParametersProvider: this.getDefaultHttpAuthSchemeParametersProvider(),
|
|
48
|
+
identityProviderConfigProvider: this.getIdentityProviderConfigProvider(),
|
|
49
|
+
}));
|
|
50
|
+
this.middlewareStack.use((0, core_1.getHttpSigningPlugin)(this.config));
|
|
37
51
|
}
|
|
38
52
|
destroy() {
|
|
39
53
|
super.destroy();
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveHttpAuthRuntimeConfig = exports.getHttpAuthExtensionConfiguration = void 0;
|
|
4
|
+
const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
|
|
5
|
+
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
|
|
6
|
+
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
|
|
7
|
+
let _credentials = runtimeConfig.credentials;
|
|
8
|
+
return {
|
|
9
|
+
setHttpAuthScheme(httpAuthScheme) {
|
|
10
|
+
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
|
|
11
|
+
if (index === -1) {
|
|
12
|
+
_httpAuthSchemes.push(httpAuthScheme);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
httpAuthSchemes() {
|
|
19
|
+
return _httpAuthSchemes;
|
|
20
|
+
},
|
|
21
|
+
setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
|
|
22
|
+
_httpAuthSchemeProvider = httpAuthSchemeProvider;
|
|
23
|
+
},
|
|
24
|
+
httpAuthSchemeProvider() {
|
|
25
|
+
return _httpAuthSchemeProvider;
|
|
26
|
+
},
|
|
27
|
+
setCredentials(credentials) {
|
|
28
|
+
_credentials = credentials;
|
|
29
|
+
},
|
|
30
|
+
credentials() {
|
|
31
|
+
return _credentials;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
exports.getHttpAuthExtensionConfiguration = getHttpAuthExtensionConfiguration;
|
|
36
|
+
const resolveHttpAuthRuntimeConfig = (config) => {
|
|
37
|
+
return {
|
|
38
|
+
httpAuthSchemes: config.httpAuthSchemes(),
|
|
39
|
+
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
|
|
40
|
+
credentials: config.credentials(),
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
exports.resolveHttpAuthRuntimeConfig = resolveHttpAuthRuntimeConfig;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveHttpAuthSchemeConfig = exports.resolveStsAuthConfig = exports.defaultSTSHttpAuthSchemeProvider = exports.defaultSTSHttpAuthSchemeParametersProvider = void 0;
|
|
4
|
+
const core_1 = require("@aws-sdk/core");
|
|
5
|
+
const util_middleware_1 = require("@smithy/util-middleware");
|
|
6
|
+
const STSClient_1 = require("../STSClient");
|
|
7
|
+
const defaultSTSHttpAuthSchemeParametersProvider = async (config, context, input) => {
|
|
8
|
+
return {
|
|
9
|
+
operation: (0, util_middleware_1.getSmithyContext)(context).operation,
|
|
10
|
+
region: (await (0, util_middleware_1.normalizeProvider)(config.region)()) ||
|
|
11
|
+
(() => {
|
|
12
|
+
throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
|
|
13
|
+
})(),
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
exports.defaultSTSHttpAuthSchemeParametersProvider = defaultSTSHttpAuthSchemeParametersProvider;
|
|
17
|
+
function createAwsAuthSigv4HttpAuthOption(authParameters) {
|
|
18
|
+
return {
|
|
19
|
+
schemeId: "aws.auth#sigv4",
|
|
20
|
+
signingProperties: {
|
|
21
|
+
name: "sts",
|
|
22
|
+
region: authParameters.region,
|
|
23
|
+
},
|
|
24
|
+
propertiesExtractor: (config, context) => ({
|
|
25
|
+
signingProperties: {
|
|
26
|
+
config,
|
|
27
|
+
context,
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function createSmithyApiNoAuthHttpAuthOption(authParameters) {
|
|
33
|
+
return {
|
|
34
|
+
schemeId: "smithy.api#noAuth",
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const defaultSTSHttpAuthSchemeProvider = (authParameters) => {
|
|
38
|
+
const options = [];
|
|
39
|
+
switch (authParameters.operation) {
|
|
40
|
+
case "AssumeRoleWithSAML": {
|
|
41
|
+
options.push(createSmithyApiNoAuthHttpAuthOption(authParameters));
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case "AssumeRoleWithWebIdentity": {
|
|
45
|
+
options.push(createSmithyApiNoAuthHttpAuthOption(authParameters));
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
default: {
|
|
49
|
+
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return options;
|
|
53
|
+
};
|
|
54
|
+
exports.defaultSTSHttpAuthSchemeProvider = defaultSTSHttpAuthSchemeProvider;
|
|
55
|
+
const resolveStsAuthConfig = (input) => ({
|
|
56
|
+
...input,
|
|
57
|
+
stsClientCtor: STSClient_1.STSClient,
|
|
58
|
+
});
|
|
59
|
+
exports.resolveStsAuthConfig = resolveStsAuthConfig;
|
|
60
|
+
const resolveHttpAuthSchemeConfig = (config) => {
|
|
61
|
+
const config_0 = (0, exports.resolveStsAuthConfig)(config);
|
|
62
|
+
const config_1 = (0, core_1.resolveAWSSDKSigV4Config)(config_0);
|
|
63
|
+
return {
|
|
64
|
+
...config_1,
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
exports.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AssumeRoleCommand = exports.$Command = void 0;
|
|
4
|
-
const middleware_signing_1 = require("@aws-sdk/middleware-signing");
|
|
5
4
|
const middleware_endpoint_1 = require("@smithy/middleware-endpoint");
|
|
6
5
|
const middleware_serde_1 = require("@smithy/middleware-serde");
|
|
7
6
|
const smithy_client_1 = require("@smithy/smithy-client");
|
|
@@ -26,7 +25,6 @@ class AssumeRoleCommand extends smithy_client_1.Command {
|
|
|
26
25
|
resolveMiddleware(clientStack, configuration, options) {
|
|
27
26
|
this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize));
|
|
28
27
|
this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, AssumeRoleCommand.getEndpointParameterInstructions()));
|
|
29
|
-
this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration));
|
|
30
28
|
const stack = clientStack.concat(this.middlewareStack);
|
|
31
29
|
const { logger } = configuration;
|
|
32
30
|
const clientName = "STSClient";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DecodeAuthorizationMessageCommand = exports.$Command = void 0;
|
|
4
|
-
const middleware_signing_1 = require("@aws-sdk/middleware-signing");
|
|
5
4
|
const middleware_endpoint_1 = require("@smithy/middleware-endpoint");
|
|
6
5
|
const middleware_serde_1 = require("@smithy/middleware-serde");
|
|
7
6
|
const smithy_client_1 = require("@smithy/smithy-client");
|
|
@@ -25,7 +24,6 @@ class DecodeAuthorizationMessageCommand extends smithy_client_1.Command {
|
|
|
25
24
|
resolveMiddleware(clientStack, configuration, options) {
|
|
26
25
|
this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize));
|
|
27
26
|
this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, DecodeAuthorizationMessageCommand.getEndpointParameterInstructions()));
|
|
28
|
-
this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration));
|
|
29
27
|
const stack = clientStack.concat(this.middlewareStack);
|
|
30
28
|
const { logger } = configuration;
|
|
31
29
|
const clientName = "STSClient";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetAccessKeyInfoCommand = exports.$Command = void 0;
|
|
4
|
-
const middleware_signing_1 = require("@aws-sdk/middleware-signing");
|
|
5
4
|
const middleware_endpoint_1 = require("@smithy/middleware-endpoint");
|
|
6
5
|
const middleware_serde_1 = require("@smithy/middleware-serde");
|
|
7
6
|
const smithy_client_1 = require("@smithy/smithy-client");
|
|
@@ -25,7 +24,6 @@ class GetAccessKeyInfoCommand extends smithy_client_1.Command {
|
|
|
25
24
|
resolveMiddleware(clientStack, configuration, options) {
|
|
26
25
|
this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize));
|
|
27
26
|
this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, GetAccessKeyInfoCommand.getEndpointParameterInstructions()));
|
|
28
|
-
this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration));
|
|
29
27
|
const stack = clientStack.concat(this.middlewareStack);
|
|
30
28
|
const { logger } = configuration;
|
|
31
29
|
const clientName = "STSClient";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetCallerIdentityCommand = exports.$Command = void 0;
|
|
4
|
-
const middleware_signing_1 = require("@aws-sdk/middleware-signing");
|
|
5
4
|
const middleware_endpoint_1 = require("@smithy/middleware-endpoint");
|
|
6
5
|
const middleware_serde_1 = require("@smithy/middleware-serde");
|
|
7
6
|
const smithy_client_1 = require("@smithy/smithy-client");
|
|
@@ -25,7 +24,6 @@ class GetCallerIdentityCommand extends smithy_client_1.Command {
|
|
|
25
24
|
resolveMiddleware(clientStack, configuration, options) {
|
|
26
25
|
this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize));
|
|
27
26
|
this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, GetCallerIdentityCommand.getEndpointParameterInstructions()));
|
|
28
|
-
this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration));
|
|
29
27
|
const stack = clientStack.concat(this.middlewareStack);
|
|
30
28
|
const { logger } = configuration;
|
|
31
29
|
const clientName = "STSClient";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetFederationTokenCommand = exports.$Command = void 0;
|
|
4
|
-
const middleware_signing_1 = require("@aws-sdk/middleware-signing");
|
|
5
4
|
const middleware_endpoint_1 = require("@smithy/middleware-endpoint");
|
|
6
5
|
const middleware_serde_1 = require("@smithy/middleware-serde");
|
|
7
6
|
const smithy_client_1 = require("@smithy/smithy-client");
|
|
@@ -26,7 +25,6 @@ class GetFederationTokenCommand extends smithy_client_1.Command {
|
|
|
26
25
|
resolveMiddleware(clientStack, configuration, options) {
|
|
27
26
|
this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize));
|
|
28
27
|
this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, GetFederationTokenCommand.getEndpointParameterInstructions()));
|
|
29
|
-
this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration));
|
|
30
28
|
const stack = clientStack.concat(this.middlewareStack);
|
|
31
29
|
const { logger } = configuration;
|
|
32
30
|
const clientName = "STSClient";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GetSessionTokenCommand = exports.$Command = void 0;
|
|
4
|
-
const middleware_signing_1 = require("@aws-sdk/middleware-signing");
|
|
5
4
|
const middleware_endpoint_1 = require("@smithy/middleware-endpoint");
|
|
6
5
|
const middleware_serde_1 = require("@smithy/middleware-serde");
|
|
7
6
|
const smithy_client_1 = require("@smithy/smithy-client");
|
|
@@ -26,7 +25,6 @@ class GetSessionTokenCommand extends smithy_client_1.Command {
|
|
|
26
25
|
resolveMiddleware(clientStack, configuration, options) {
|
|
27
26
|
this.middlewareStack.use((0, middleware_serde_1.getSerdePlugin)(configuration, this.serialize, this.deserialize));
|
|
28
27
|
this.middlewareStack.use((0, middleware_endpoint_1.getEndpointPlugin)(configuration, GetSessionTokenCommand.getEndpointParameterInstructions()));
|
|
29
|
-
this.middlewareStack.use((0, middleware_signing_1.getAwsAuthPlugin)(configuration));
|
|
30
28
|
const stack = clientStack.concat(this.middlewareStack);
|
|
31
29
|
const { logger } = configuration;
|
|
32
30
|
const clientName = "STSClient";
|
package/dist-cjs/index.js
CHANGED
|
@@ -6,7 +6,7 @@ tslib_1.__exportStar(require("./STSClient"), exports);
|
|
|
6
6
|
tslib_1.__exportStar(require("./STS"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./commands"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./models"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./defaultRoleAssumers"), exports);
|
|
10
9
|
require("@aws-sdk/util-endpoints");
|
|
10
|
+
tslib_1.__exportStar(require("./defaultRoleAssumers"), exports);
|
|
11
11
|
var STSServiceException_1 = require("./models/STSServiceException");
|
|
12
12
|
Object.defineProperty(exports, "STSServiceException", { enumerable: true, get: function () { return STSServiceException_1.STSServiceException; } });
|
|
@@ -8,6 +8,7 @@ const core_1 = require("@aws-sdk/core");
|
|
|
8
8
|
const credential_provider_node_1 = require("@aws-sdk/credential-provider-node");
|
|
9
9
|
const util_user_agent_node_1 = require("@aws-sdk/util-user-agent-node");
|
|
10
10
|
const config_resolver_1 = require("@smithy/config-resolver");
|
|
11
|
+
const core_2 = require("@smithy/core");
|
|
11
12
|
const hash_node_1 = require("@smithy/hash-node");
|
|
12
13
|
const middleware_retry_1 = require("@smithy/middleware-retry");
|
|
13
14
|
const node_config_provider_1 = require("@smithy/node-config-provider");
|
|
@@ -33,6 +34,19 @@ const getRuntimeConfig = (config) => {
|
|
|
33
34
|
credentialDefaultProvider: config?.credentialDefaultProvider ?? (0, defaultStsRoleAssumers_1.decorateDefaultCredentialProvider)(credential_provider_node_1.defaultProvider),
|
|
34
35
|
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
35
36
|
(0, util_user_agent_node_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
|
|
37
|
+
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
|
38
|
+
{
|
|
39
|
+
schemeId: "aws.auth#sigv4",
|
|
40
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4") ||
|
|
41
|
+
(async (idProps) => await (0, defaultStsRoleAssumers_1.decorateDefaultCredentialProvider)(credential_provider_node_1.defaultProvider)(idProps?.__config || {})()),
|
|
42
|
+
signer: new core_1.AWSSDKSigV4Signer(),
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
schemeId: "smithy.api#noAuth",
|
|
46
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
|
47
|
+
signer: new core_2.NoAuthSigner(),
|
|
48
|
+
},
|
|
49
|
+
],
|
|
36
50
|
maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
|
|
37
51
|
region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS),
|
|
38
52
|
requestHandler: config?.requestHandler ?? new node_http_handler_1.NodeHttpHandler(defaultConfigProvider),
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getRuntimeConfig = void 0;
|
|
4
|
+
const core_1 = require("@aws-sdk/core");
|
|
5
|
+
const core_2 = require("@smithy/core");
|
|
4
6
|
const smithy_client_1 = require("@smithy/smithy-client");
|
|
5
7
|
const url_parser_1 = require("@smithy/url-parser");
|
|
6
8
|
const util_base64_1 = require("@smithy/util-base64");
|
|
7
9
|
const util_utf8_1 = require("@smithy/util-utf8");
|
|
10
|
+
const httpAuthSchemeProvider_1 = require("./auth/httpAuthSchemeProvider");
|
|
8
11
|
const endpointResolver_1 = require("./endpoint/endpointResolver");
|
|
9
12
|
const getRuntimeConfig = (config) => {
|
|
10
13
|
return {
|
|
@@ -14,6 +17,19 @@ const getRuntimeConfig = (config) => {
|
|
|
14
17
|
disableHostPrefix: config?.disableHostPrefix ?? false,
|
|
15
18
|
endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver,
|
|
16
19
|
extensions: config?.extensions ?? [],
|
|
20
|
+
httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultSTSHttpAuthSchemeProvider,
|
|
21
|
+
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
|
22
|
+
{
|
|
23
|
+
schemeId: "aws.auth#sigv4",
|
|
24
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
|
|
25
|
+
signer: new core_1.AWSSDKSigV4Signer(),
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
schemeId: "smithy.api#noAuth",
|
|
29
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
|
30
|
+
signer: new core_2.NoAuthSigner(),
|
|
31
|
+
},
|
|
32
|
+
],
|
|
17
33
|
logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
|
|
18
34
|
serviceId: config?.serviceId ?? "STS",
|
|
19
35
|
urlParser: config?.urlParser ?? url_parser_1.parseUrl,
|
|
@@ -4,12 +4,14 @@ exports.resolveRuntimeExtensions = void 0;
|
|
|
4
4
|
const region_config_resolver_1 = require("@aws-sdk/region-config-resolver");
|
|
5
5
|
const protocol_http_1 = require("@smithy/protocol-http");
|
|
6
6
|
const smithy_client_1 = require("@smithy/smithy-client");
|
|
7
|
+
const httpAuthExtensionConfiguration_1 = require("./auth/httpAuthExtensionConfiguration");
|
|
7
8
|
const asPartial = (t) => t;
|
|
8
9
|
const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
|
|
9
10
|
const extensionConfiguration = {
|
|
10
11
|
...asPartial((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig)),
|
|
11
12
|
...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)),
|
|
12
13
|
...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)),
|
|
14
|
+
...asPartial((0, httpAuthExtensionConfiguration_1.getHttpAuthExtensionConfiguration)(runtimeConfig)),
|
|
13
15
|
};
|
|
14
16
|
extensions.forEach((extension) => extension.configure(extensionConfiguration));
|
|
15
17
|
return {
|
|
@@ -17,6 +19,7 @@ const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
|
|
|
17
19
|
...(0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration),
|
|
18
20
|
...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration),
|
|
19
21
|
...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration),
|
|
22
|
+
...(0, httpAuthExtensionConfiguration_1.resolveHttpAuthRuntimeConfig)(extensionConfiguration),
|
|
20
23
|
};
|
|
21
24
|
};
|
|
22
25
|
exports.resolveRuntimeExtensions = resolveRuntimeExtensions;
|
package/dist-es/STSClient.js
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import { getHostHeaderPlugin, resolveHostHeaderConfig, } from "@aws-sdk/middleware-host-header";
|
|
2
2
|
import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
|
|
3
3
|
import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection";
|
|
4
|
-
import { resolveStsAuthConfig } from "@aws-sdk/middleware-sdk-sts";
|
|
5
4
|
import { getUserAgentPlugin, resolveUserAgentConfig, } from "@aws-sdk/middleware-user-agent";
|
|
6
5
|
import { resolveRegionConfig } from "@smithy/config-resolver";
|
|
6
|
+
import { DefaultIdentityProviderConfig, getHttpAuthSchemeEndpointRuleSetPlugin, getHttpSigningPlugin, } from "@smithy/core";
|
|
7
7
|
import { getContentLengthPlugin } from "@smithy/middleware-content-length";
|
|
8
8
|
import { resolveEndpointConfig } from "@smithy/middleware-endpoint";
|
|
9
9
|
import { getRetryPlugin, resolveRetryConfig } from "@smithy/middleware-retry";
|
|
10
10
|
import { Client as __Client, } from "@smithy/smithy-client";
|
|
11
|
+
import { defaultSTSHttpAuthSchemeParametersProvider, resolveHttpAuthSchemeConfig, } from "./auth/httpAuthSchemeProvider";
|
|
11
12
|
import { resolveClientEndpointParameters, } from "./endpoint/EndpointParameters";
|
|
12
13
|
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
|
|
13
14
|
import { resolveRuntimeExtensions } from "./runtimeExtensions";
|
|
14
15
|
export { __Client };
|
|
15
16
|
export class STSClient extends __Client {
|
|
17
|
+
getDefaultHttpAuthSchemeParametersProvider() {
|
|
18
|
+
return defaultSTSHttpAuthSchemeParametersProvider;
|
|
19
|
+
}
|
|
20
|
+
getIdentityProviderConfigProvider() {
|
|
21
|
+
return async (config) => new DefaultIdentityProviderConfig({
|
|
22
|
+
"aws.auth#sigv4": config.credentials,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
16
25
|
constructor(...[configuration]) {
|
|
17
26
|
const _config_0 = __getRuntimeConfig(configuration || {});
|
|
18
27
|
const _config_1 = resolveClientEndpointParameters(_config_0);
|
|
@@ -20,8 +29,8 @@ export class STSClient extends __Client {
|
|
|
20
29
|
const _config_3 = resolveEndpointConfig(_config_2);
|
|
21
30
|
const _config_4 = resolveRetryConfig(_config_3);
|
|
22
31
|
const _config_5 = resolveHostHeaderConfig(_config_4);
|
|
23
|
-
const _config_6 =
|
|
24
|
-
const _config_7 =
|
|
32
|
+
const _config_6 = resolveUserAgentConfig(_config_5);
|
|
33
|
+
const _config_7 = resolveHttpAuthSchemeConfig(_config_6);
|
|
25
34
|
const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
|
|
26
35
|
super(_config_8);
|
|
27
36
|
this.config = _config_8;
|
|
@@ -31,6 +40,11 @@ export class STSClient extends __Client {
|
|
|
31
40
|
this.middlewareStack.use(getLoggerPlugin(this.config));
|
|
32
41
|
this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
|
|
33
42
|
this.middlewareStack.use(getUserAgentPlugin(this.config));
|
|
43
|
+
this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
|
|
44
|
+
httpAuthSchemeParametersProvider: this.getDefaultHttpAuthSchemeParametersProvider(),
|
|
45
|
+
identityProviderConfigProvider: this.getIdentityProviderConfigProvider(),
|
|
46
|
+
}));
|
|
47
|
+
this.middlewareStack.use(getHttpSigningPlugin(this.config));
|
|
34
48
|
}
|
|
35
49
|
destroy() {
|
|
36
50
|
super.destroy();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
|
|
2
|
+
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
|
|
3
|
+
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
|
|
4
|
+
let _credentials = runtimeConfig.credentials;
|
|
5
|
+
return {
|
|
6
|
+
setHttpAuthScheme(httpAuthScheme) {
|
|
7
|
+
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
|
|
8
|
+
if (index === -1) {
|
|
9
|
+
_httpAuthSchemes.push(httpAuthScheme);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
httpAuthSchemes() {
|
|
16
|
+
return _httpAuthSchemes;
|
|
17
|
+
},
|
|
18
|
+
setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
|
|
19
|
+
_httpAuthSchemeProvider = httpAuthSchemeProvider;
|
|
20
|
+
},
|
|
21
|
+
httpAuthSchemeProvider() {
|
|
22
|
+
return _httpAuthSchemeProvider;
|
|
23
|
+
},
|
|
24
|
+
setCredentials(credentials) {
|
|
25
|
+
_credentials = credentials;
|
|
26
|
+
},
|
|
27
|
+
credentials() {
|
|
28
|
+
return _credentials;
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export const resolveHttpAuthRuntimeConfig = (config) => {
|
|
33
|
+
return {
|
|
34
|
+
httpAuthSchemes: config.httpAuthSchemes(),
|
|
35
|
+
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
|
|
36
|
+
credentials: config.credentials(),
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { resolveAWSSDKSigV4Config, } from "@aws-sdk/core";
|
|
2
|
+
import { getSmithyContext, normalizeProvider } from "@smithy/util-middleware";
|
|
3
|
+
import { STSClient } from "../STSClient";
|
|
4
|
+
export const defaultSTSHttpAuthSchemeParametersProvider = async (config, context, input) => {
|
|
5
|
+
return {
|
|
6
|
+
operation: getSmithyContext(context).operation,
|
|
7
|
+
region: (await normalizeProvider(config.region)()) ||
|
|
8
|
+
(() => {
|
|
9
|
+
throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
|
|
10
|
+
})(),
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
function createAwsAuthSigv4HttpAuthOption(authParameters) {
|
|
14
|
+
return {
|
|
15
|
+
schemeId: "aws.auth#sigv4",
|
|
16
|
+
signingProperties: {
|
|
17
|
+
name: "sts",
|
|
18
|
+
region: authParameters.region,
|
|
19
|
+
},
|
|
20
|
+
propertiesExtractor: (config, context) => ({
|
|
21
|
+
signingProperties: {
|
|
22
|
+
config,
|
|
23
|
+
context,
|
|
24
|
+
},
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function createSmithyApiNoAuthHttpAuthOption(authParameters) {
|
|
29
|
+
return {
|
|
30
|
+
schemeId: "smithy.api#noAuth",
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export const defaultSTSHttpAuthSchemeProvider = (authParameters) => {
|
|
34
|
+
const options = [];
|
|
35
|
+
switch (authParameters.operation) {
|
|
36
|
+
case "AssumeRoleWithSAML": {
|
|
37
|
+
options.push(createSmithyApiNoAuthHttpAuthOption(authParameters));
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case "AssumeRoleWithWebIdentity": {
|
|
41
|
+
options.push(createSmithyApiNoAuthHttpAuthOption(authParameters));
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
default: {
|
|
45
|
+
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return options;
|
|
49
|
+
};
|
|
50
|
+
export const resolveStsAuthConfig = (input) => ({
|
|
51
|
+
...input,
|
|
52
|
+
stsClientCtor: STSClient,
|
|
53
|
+
});
|
|
54
|
+
export const resolveHttpAuthSchemeConfig = (config) => {
|
|
55
|
+
const config_0 = resolveStsAuthConfig(config);
|
|
56
|
+
const config_1 = resolveAWSSDKSigV4Config(config_0);
|
|
57
|
+
return {
|
|
58
|
+
...config_1,
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getAwsAuthPlugin } from "@aws-sdk/middleware-signing";
|
|
2
1
|
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
|
|
3
2
|
import { getSerdePlugin } from "@smithy/middleware-serde";
|
|
4
3
|
import { Command as $Command } from "@smithy/smithy-client";
|
|
@@ -23,7 +22,6 @@ export class AssumeRoleCommand extends $Command {
|
|
|
23
22
|
resolveMiddleware(clientStack, configuration, options) {
|
|
24
23
|
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
|
|
25
24
|
this.middlewareStack.use(getEndpointPlugin(configuration, AssumeRoleCommand.getEndpointParameterInstructions()));
|
|
26
|
-
this.middlewareStack.use(getAwsAuthPlugin(configuration));
|
|
27
25
|
const stack = clientStack.concat(this.middlewareStack);
|
|
28
26
|
const { logger } = configuration;
|
|
29
27
|
const clientName = "STSClient";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getAwsAuthPlugin } from "@aws-sdk/middleware-signing";
|
|
2
1
|
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
|
|
3
2
|
import { getSerdePlugin } from "@smithy/middleware-serde";
|
|
4
3
|
import { Command as $Command } from "@smithy/smithy-client";
|
|
@@ -22,7 +21,6 @@ export class DecodeAuthorizationMessageCommand extends $Command {
|
|
|
22
21
|
resolveMiddleware(clientStack, configuration, options) {
|
|
23
22
|
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
|
|
24
23
|
this.middlewareStack.use(getEndpointPlugin(configuration, DecodeAuthorizationMessageCommand.getEndpointParameterInstructions()));
|
|
25
|
-
this.middlewareStack.use(getAwsAuthPlugin(configuration));
|
|
26
24
|
const stack = clientStack.concat(this.middlewareStack);
|
|
27
25
|
const { logger } = configuration;
|
|
28
26
|
const clientName = "STSClient";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getAwsAuthPlugin } from "@aws-sdk/middleware-signing";
|
|
2
1
|
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
|
|
3
2
|
import { getSerdePlugin } from "@smithy/middleware-serde";
|
|
4
3
|
import { Command as $Command } from "@smithy/smithy-client";
|
|
@@ -22,7 +21,6 @@ export class GetAccessKeyInfoCommand extends $Command {
|
|
|
22
21
|
resolveMiddleware(clientStack, configuration, options) {
|
|
23
22
|
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
|
|
24
23
|
this.middlewareStack.use(getEndpointPlugin(configuration, GetAccessKeyInfoCommand.getEndpointParameterInstructions()));
|
|
25
|
-
this.middlewareStack.use(getAwsAuthPlugin(configuration));
|
|
26
24
|
const stack = clientStack.concat(this.middlewareStack);
|
|
27
25
|
const { logger } = configuration;
|
|
28
26
|
const clientName = "STSClient";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getAwsAuthPlugin } from "@aws-sdk/middleware-signing";
|
|
2
1
|
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
|
|
3
2
|
import { getSerdePlugin } from "@smithy/middleware-serde";
|
|
4
3
|
import { Command as $Command } from "@smithy/smithy-client";
|
|
@@ -22,7 +21,6 @@ export class GetCallerIdentityCommand extends $Command {
|
|
|
22
21
|
resolveMiddleware(clientStack, configuration, options) {
|
|
23
22
|
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
|
|
24
23
|
this.middlewareStack.use(getEndpointPlugin(configuration, GetCallerIdentityCommand.getEndpointParameterInstructions()));
|
|
25
|
-
this.middlewareStack.use(getAwsAuthPlugin(configuration));
|
|
26
24
|
const stack = clientStack.concat(this.middlewareStack);
|
|
27
25
|
const { logger } = configuration;
|
|
28
26
|
const clientName = "STSClient";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getAwsAuthPlugin } from "@aws-sdk/middleware-signing";
|
|
2
1
|
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
|
|
3
2
|
import { getSerdePlugin } from "@smithy/middleware-serde";
|
|
4
3
|
import { Command as $Command } from "@smithy/smithy-client";
|
|
@@ -23,7 +22,6 @@ export class GetFederationTokenCommand extends $Command {
|
|
|
23
22
|
resolveMiddleware(clientStack, configuration, options) {
|
|
24
23
|
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
|
|
25
24
|
this.middlewareStack.use(getEndpointPlugin(configuration, GetFederationTokenCommand.getEndpointParameterInstructions()));
|
|
26
|
-
this.middlewareStack.use(getAwsAuthPlugin(configuration));
|
|
27
25
|
const stack = clientStack.concat(this.middlewareStack);
|
|
28
26
|
const { logger } = configuration;
|
|
29
27
|
const clientName = "STSClient";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getAwsAuthPlugin } from "@aws-sdk/middleware-signing";
|
|
2
1
|
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
|
|
3
2
|
import { getSerdePlugin } from "@smithy/middleware-serde";
|
|
4
3
|
import { Command as $Command } from "@smithy/smithy-client";
|
|
@@ -23,7 +22,6 @@ export class GetSessionTokenCommand extends $Command {
|
|
|
23
22
|
resolveMiddleware(clientStack, configuration, options) {
|
|
24
23
|
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
|
|
25
24
|
this.middlewareStack.use(getEndpointPlugin(configuration, GetSessionTokenCommand.getEndpointParameterInstructions()));
|
|
26
|
-
this.middlewareStack.use(getAwsAuthPlugin(configuration));
|
|
27
25
|
const stack = clientStack.concat(this.middlewareStack);
|
|
28
26
|
const { logger } = configuration;
|
|
29
27
|
const clientName = "STSClient";
|
package/dist-es/index.js
CHANGED
|
@@ -2,6 +2,6 @@ export * from "./STSClient";
|
|
|
2
2
|
export * from "./STS";
|
|
3
3
|
export * from "./commands";
|
|
4
4
|
export * from "./models";
|
|
5
|
-
export * from "./defaultRoleAssumers";
|
|
6
5
|
import "@aws-sdk/util-endpoints";
|
|
6
|
+
export * from "./defaultRoleAssumers";
|
|
7
7
|
export { STSServiceException } from "./models/STSServiceException";
|
package/dist-es/runtimeConfig.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import packageInfo from "../package.json";
|
|
2
2
|
import { decorateDefaultCredentialProvider } from "./defaultStsRoleAssumers";
|
|
3
|
-
import { emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core";
|
|
3
|
+
import { AWSSDKSigV4Signer, emitWarningIfUnsupportedVersion as awsCheckVersion } from "@aws-sdk/core";
|
|
4
4
|
import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
|
|
5
5
|
import { defaultUserAgent } from "@aws-sdk/util-user-agent-node";
|
|
6
6
|
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, } from "@smithy/config-resolver";
|
|
7
|
+
import { NoAuthSigner } from "@smithy/core";
|
|
7
8
|
import { Hash } from "@smithy/hash-node";
|
|
8
9
|
import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@smithy/middleware-retry";
|
|
9
10
|
import { loadConfig as loadNodeConfig } from "@smithy/node-config-provider";
|
|
@@ -29,6 +30,19 @@ export const getRuntimeConfig = (config) => {
|
|
|
29
30
|
credentialDefaultProvider: config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider),
|
|
30
31
|
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
31
32
|
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
33
|
+
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
|
34
|
+
{
|
|
35
|
+
schemeId: "aws.auth#sigv4",
|
|
36
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4") ||
|
|
37
|
+
(async (idProps) => await decorateDefaultCredentialProvider(credentialDefaultProvider)(idProps?.__config || {})()),
|
|
38
|
+
signer: new AWSSDKSigV4Signer(),
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
schemeId: "smithy.api#noAuth",
|
|
42
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
|
43
|
+
signer: new NoAuthSigner(),
|
|
44
|
+
},
|
|
45
|
+
],
|
|
32
46
|
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
|
|
33
47
|
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
|
|
34
48
|
requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
|