@aws-sdk/credential-providers 3.499.0 → 3.502.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.
Files changed (50) hide show
  1. package/README.md +34 -0
  2. package/dist-cjs/fromCognitoIdentity.js +3 -8
  3. package/dist-cjs/fromCognitoIdentityPool.js +3 -8
  4. package/dist-cjs/fromContainerMetadata.js +5 -1
  5. package/dist-cjs/fromEnv.js +1 -1
  6. package/dist-cjs/fromIni.js +3 -9
  7. package/dist-cjs/fromInstanceMetadata.js +5 -1
  8. package/dist-cjs/fromNodeProviderChain.js +3 -9
  9. package/dist-cjs/fromSSO.js +3 -2
  10. package/dist-cjs/fromTemporaryCredentials.js +6 -5
  11. package/dist-cjs/fromTokenFile.js +3 -8
  12. package/dist-cjs/fromWebToken.js +3 -8
  13. package/dist-cjs/loadSts.js +6 -0
  14. package/dist-es/fromCognitoIdentity.js +0 -2
  15. package/dist-es/fromCognitoIdentityPool.js +0 -2
  16. package/dist-es/fromContainerMetadata.js +4 -1
  17. package/dist-es/fromEnv.js +1 -1
  18. package/dist-es/fromIni.js +0 -3
  19. package/dist-es/fromInstanceMetadata.js +4 -1
  20. package/dist-es/fromNodeProviderChain.js +0 -3
  21. package/dist-es/fromSSO.js +3 -2
  22. package/dist-es/fromTemporaryCredentials.js +2 -1
  23. package/dist-es/fromTokenFile.js +1 -3
  24. package/dist-es/fromWebToken.js +1 -3
  25. package/dist-es/loadSts.js +2 -0
  26. package/dist-types/fromCognitoIdentity.d.ts +1 -1
  27. package/dist-types/fromCognitoIdentityPool.d.ts +1 -1
  28. package/dist-types/fromContainerMetadata.d.ts +2 -1
  29. package/dist-types/fromEnv.d.ts +2 -1
  30. package/dist-types/fromIni.d.ts +2 -7
  31. package/dist-types/fromInstanceMetadata.d.ts +2 -1
  32. package/dist-types/fromNodeProviderChain.d.ts +2 -7
  33. package/dist-types/fromProcess.d.ts +1 -3
  34. package/dist-types/fromSSO.d.ts +1 -5
  35. package/dist-types/fromTemporaryCredentials.d.ts +3 -2
  36. package/dist-types/fromTokenFile.d.ts +2 -7
  37. package/dist-types/fromWebToken.d.ts +2 -7
  38. package/dist-types/loadSts.d.ts +2 -0
  39. package/dist-types/ts3.4/fromContainerMetadata.d.ts +4 -1
  40. package/dist-types/ts3.4/fromEnv.d.ts +4 -1
  41. package/dist-types/ts3.4/fromIni.d.ts +2 -7
  42. package/dist-types/ts3.4/fromInstanceMetadata.d.ts +2 -1
  43. package/dist-types/ts3.4/fromNodeProviderChain.d.ts +2 -7
  44. package/dist-types/ts3.4/fromProcess.d.ts +1 -2
  45. package/dist-types/ts3.4/fromSSO.d.ts +1 -6
  46. package/dist-types/ts3.4/fromTemporaryCredentials.d.ts +3 -1
  47. package/dist-types/ts3.4/fromTokenFile.d.ts +2 -7
  48. package/dist-types/ts3.4/fromWebToken.d.ts +2 -7
  49. package/dist-types/ts3.4/loadSts.d.ts +2 -0
  50. package/package.json +13 -13
package/README.md CHANGED
@@ -28,6 +28,9 @@ A collection of all credential providers, with default clients.
28
28
 
29
29
  ## `fromCognitoIdentity()`
30
30
 
31
+ - Uses `@aws-sdk/client-cognito-identity`
32
+ - Available in browsers & native apps
33
+
31
34
  The function `fromCognitoIdentity()` returns `CredentialsProvider` that retrieves credentials for
32
35
  the provided identity ID. See [GetCredentialsForIdentity API][getcredentialsforidentity_api]
33
36
  for more information.
@@ -63,6 +66,9 @@ const client = new FooClient({
63
66
 
64
67
  ## `fromCognitoIdentityPool()`
65
68
 
69
+ - Uses `@aws-sdk/client-cognito-identity`
70
+ - Available in browsers & native apps
71
+
66
72
  The function `fromCognitoIdentityPool()` returns `AwsCredentialIdentityProvider` that calls [GetId API][getid_api]
67
73
  to obtain an `identityId`, then generates temporary AWS credentials with
68
74
  [GetCredentialsForIdentity API][getcredentialsforidentity_api], see
@@ -108,6 +114,9 @@ const client = new FooClient({
108
114
 
109
115
  ## `fromTemporaryCredentials()`
110
116
 
117
+ - Uses `@aws-sdk/client-sts`
118
+ - Available in browsers & native apps
119
+
111
120
  The function `fromTemporaryCredentials` returns `AwsCredentialIdentityProvider` that retrieves temporary
112
121
  credentials from [STS AssumeRole API][assumerole_api].
113
122
 
@@ -147,6 +156,9 @@ const client = new FooClient({
147
156
 
148
157
  ## `fromWebToken()`
149
158
 
159
+ - Uses `@aws-sdk/client-sts`
160
+ - Available in browsers & native apps
161
+
150
162
  The function `fromWebToken` returns `AwsCredentialIdentityProvider` that gets credentials calling
151
163
  [STS AssumeRoleWithWebIdentity API][assumerolewithwebidentity_api]
152
164
 
@@ -210,6 +222,8 @@ provider, see the documentation for the identity provider.
210
222
 
211
223
  ## `fromContainerMetadata()` and `fromInstanceMetadata()`
212
224
 
225
+ - Not available in browsers & native apps
226
+
213
227
  `fromContainerMetadata` and `fromInstanceMetadata` will create `AwsCredentialIdentityProvider` functions that
214
228
  read from the ECS container metadata service and the EC2 instance metadata service, respectively.
215
229
 
@@ -260,6 +274,8 @@ Please see [Configure the instance metadata service][config_instance_metadata] f
260
274
 
261
275
  ## `fromHttp()`
262
276
 
277
+ - Available in browsers & native apps, without the EC2 and Container metadata components.
278
+
263
279
  This creates a provider function that makes a `GET` request to
264
280
  any provided HTTPS URL. A limited set of HTTP destinations are also accepted.
265
281
 
@@ -359,6 +375,10 @@ const client = new FooClient({
359
375
 
360
376
  ## `fromIni()`
361
377
 
378
+ - May use `@aws-sdk/client-sso` or `@aws-sdk/client-sts` depending
379
+ on how the file is configured.
380
+ - Not available in browsers & native apps.
381
+
362
382
  `fromIni` creates `AwsCredentialIdentityProvider` functions that read from a shared credentials file at
363
383
  `~/.aws/credentials` and a shared configuration file at `~/.aws/config`. Both files are expected to
364
384
  be INI formatted with section names corresponding to profiles. Sections in the credentials file are
@@ -485,6 +505,8 @@ See [`fromSSO()`](#fromsso) fro more information
485
505
 
486
506
  ## `fromEnv()`
487
507
 
508
+ - Not available in browser & native apps
509
+
488
510
  ```javascript
489
511
  import { fromEnv } from "@aws-sdk/credential-providers"; // ES6 import
490
512
  // const { fromEnv } = require("@aws-sdk/credential-providers"); // CommonJS import
@@ -510,6 +532,8 @@ contains a falsy value, the promise returned by the `fromEnv` function will be r
510
532
 
511
533
  ## `fromProcess()`
512
534
 
535
+ - Not available in browsers & native apps
536
+
513
537
  ```javascript
514
538
  import { fromProcess } from "@aws-sdk/credential-providers"; // ES6 import
515
539
  // const { fromProcess } = require("@aws-sdk/credential-providers"); // CommonJS import
@@ -566,6 +590,9 @@ credential_process = /usr/local/bin/awscreds dev
566
590
 
567
591
  ## `fromTokenFile()`
568
592
 
593
+ - Uses `@aws-sdk/client-sts`
594
+ - Not available in browsers & native apps
595
+
569
596
  The function `fromTokenFile` returns `AwsCredentialIdentityProvider` that reads credentials as follows:
570
597
 
571
598
  - Reads file location of where the OIDC token is stored from either provided option
@@ -598,6 +625,9 @@ const client = new FooClient({
598
625
 
599
626
  ## `fromSSO()`
600
627
 
628
+ - Uses `@aws-sdk/client-sso` & `@aws-sdk/client-sso-oidc`
629
+ - Not available in browsers & native apps
630
+
601
631
  > This credential provider **ONLY** supports profiles using the SSO credential. If you have a
602
632
  > profile that assumes a role which derived from the SSO credential, you should use the
603
633
  > [`fromIni()`](#fromini), or `@aws-sdk/credential-provider-node` package.
@@ -718,6 +748,10 @@ sso_start_url = https://d-abc123.awsapps.com/start
718
748
 
719
749
  ## `fromNodeProviderChain()`
720
750
 
751
+ - May use `@aws-sdk/client-sts`, `@aws-sdk/client-sso`, etc. depending on
752
+ which link in the chain finally resolves credentials.
753
+ - Not available in browsers & native apps
754
+
721
755
  The credential provider used as default in the Node.js clients, but with default role assumers so
722
756
  you don't need to import them from STS client and supply them manually. You normally don't need
723
757
  to use this explicitly in the client constructor. It is useful for utility functions requiring
@@ -1,13 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fromCognitoIdentity = void 0;
4
- const client_cognito_identity_1 = require("@aws-sdk/client-cognito-identity");
5
4
  const credential_provider_cognito_identity_1 = require("@aws-sdk/credential-provider-cognito-identity");
6
- const fromCognitoIdentity = (options) => {
7
- var _a;
8
- return (0, credential_provider_cognito_identity_1.fromCognitoIdentity)({
9
- ...options,
10
- client: new client_cognito_identity_1.CognitoIdentityClient((_a = options.clientConfig) !== null && _a !== void 0 ? _a : {}),
11
- });
12
- };
5
+ const fromCognitoIdentity = (options) => (0, credential_provider_cognito_identity_1.fromCognitoIdentity)({
6
+ ...options,
7
+ });
13
8
  exports.fromCognitoIdentity = fromCognitoIdentity;
@@ -1,13 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fromCognitoIdentityPool = void 0;
4
- const client_cognito_identity_1 = require("@aws-sdk/client-cognito-identity");
5
4
  const credential_provider_cognito_identity_1 = require("@aws-sdk/credential-provider-cognito-identity");
6
- const fromCognitoIdentityPool = (options) => {
7
- var _a;
8
- return (0, credential_provider_cognito_identity_1.fromCognitoIdentityPool)({
9
- ...options,
10
- client: new client_cognito_identity_1.CognitoIdentityClient((_a = options.clientConfig) !== null && _a !== void 0 ? _a : {}),
11
- });
12
- };
5
+ const fromCognitoIdentityPool = (options) => (0, credential_provider_cognito_identity_1.fromCognitoIdentityPool)({
6
+ ...options,
7
+ });
13
8
  exports.fromCognitoIdentityPool = fromCognitoIdentityPool;
@@ -2,5 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fromContainerMetadata = void 0;
4
4
  const credential_provider_imds_1 = require("@smithy/credential-provider-imds");
5
- const fromContainerMetadata = (init) => (0, credential_provider_imds_1.fromContainerMetadata)(init);
5
+ const fromContainerMetadata = (init) => {
6
+ var _a;
7
+ (_a = init === null || init === void 0 ? void 0 : init.logger) === null || _a === void 0 ? void 0 : _a.debug("@smithy/credential-provider-imds", "fromContainerMetadata");
8
+ return (0, credential_provider_imds_1.fromContainerMetadata)(init);
9
+ };
6
10
  exports.fromContainerMetadata = fromContainerMetadata;
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fromEnv = void 0;
4
4
  const credential_provider_env_1 = require("@aws-sdk/credential-provider-env");
5
- const fromEnv = () => (0, credential_provider_env_1.fromEnv)();
5
+ const fromEnv = (init) => (0, credential_provider_env_1.fromEnv)(init);
6
6
  exports.fromEnv = fromEnv;
@@ -1,14 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fromIni = void 0;
4
- const client_sts_1 = require("@aws-sdk/client-sts");
5
4
  const credential_provider_ini_1 = require("@aws-sdk/credential-provider-ini");
6
- const fromIni = (init = {}) => {
7
- var _a, _b;
8
- return (0, credential_provider_ini_1.fromIni)({
9
- ...init,
10
- roleAssumer: (_a = init.roleAssumer) !== null && _a !== void 0 ? _a : (0, client_sts_1.getDefaultRoleAssumer)(init.clientConfig, init.clientPlugins),
11
- roleAssumerWithWebIdentity: (_b = init.roleAssumerWithWebIdentity) !== null && _b !== void 0 ? _b : (0, client_sts_1.getDefaultRoleAssumerWithWebIdentity)(init.clientConfig, init.clientPlugins),
12
- });
13
- };
5
+ const fromIni = (init = {}) => (0, credential_provider_ini_1.fromIni)({
6
+ ...init,
7
+ });
14
8
  exports.fromIni = fromIni;
@@ -2,5 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fromInstanceMetadata = void 0;
4
4
  const credential_provider_imds_1 = require("@smithy/credential-provider-imds");
5
- const fromInstanceMetadata = (init) => (0, credential_provider_imds_1.fromInstanceMetadata)(init);
5
+ const fromInstanceMetadata = (init) => {
6
+ var _a;
7
+ (_a = init === null || init === void 0 ? void 0 : init.logger) === null || _a === void 0 ? void 0 : _a.debug("@smithy/credential-provider-imds", "fromInstanceMetadata");
8
+ return (0, credential_provider_imds_1.fromInstanceMetadata)(init);
9
+ };
6
10
  exports.fromInstanceMetadata = fromInstanceMetadata;
@@ -1,14 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fromNodeProviderChain = void 0;
4
- const client_sts_1 = require("@aws-sdk/client-sts");
5
4
  const credential_provider_node_1 = require("@aws-sdk/credential-provider-node");
6
- const fromNodeProviderChain = (init = {}) => {
7
- var _a, _b;
8
- return (0, credential_provider_node_1.defaultProvider)({
9
- ...init,
10
- roleAssumer: (_a = init.roleAssumer) !== null && _a !== void 0 ? _a : (0, client_sts_1.getDefaultRoleAssumer)(init.clientConfig, init.clientPlugins),
11
- roleAssumerWithWebIdentity: (_b = init.roleAssumerWithWebIdentity) !== null && _b !== void 0 ? _b : (0, client_sts_1.getDefaultRoleAssumerWithWebIdentity)(init.clientConfig, init.clientPlugins),
12
- });
13
- };
5
+ const fromNodeProviderChain = (init = {}) => (0, credential_provider_node_1.defaultProvider)({
6
+ ...init,
7
+ });
14
8
  exports.fromNodeProviderChain = fromNodeProviderChain;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fromSSO = void 0;
4
- const client_sso_1 = require("@aws-sdk/client-sso");
5
4
  const credential_provider_sso_1 = require("@aws-sdk/credential-provider-sso");
6
- const fromSSO = (init = {}) => (0, credential_provider_sso_1.fromSSO)({ ...{ ssoClient: init.clientConfig ? new client_sso_1.SSOClient(init.clientConfig) : undefined }, ...init });
5
+ const fromSSO = (init = {}) => {
6
+ return (0, credential_provider_sso_1.fromSSO)({ ...init });
7
+ };
7
8
  exports.fromSSO = fromSSO;
@@ -1,27 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fromTemporaryCredentials = void 0;
4
- const client_sts_1 = require("@aws-sdk/client-sts");
5
4
  const property_provider_1 = require("@smithy/property-provider");
6
5
  const fromTemporaryCredentials = (options) => {
7
6
  let stsClient;
8
7
  return async () => {
9
- var _a;
10
- const params = { ...options.params, RoleSessionName: (_a = options.params.RoleSessionName) !== null && _a !== void 0 ? _a : "aws-sdk-js-" + Date.now() };
8
+ var _a, _b;
9
+ (_a = options.logger) === null || _a === void 0 ? void 0 : _a.debug("@aws-sdk/credential-providers", "fromTemporaryCredentials (STS)");
10
+ const params = { ...options.params, RoleSessionName: (_b = options.params.RoleSessionName) !== null && _b !== void 0 ? _b : "aws-sdk-js-" + Date.now() };
11
11
  if (params === null || params === void 0 ? void 0 : params.SerialNumber) {
12
12
  if (!options.mfaCodeProvider) {
13
13
  throw new property_provider_1.CredentialsProviderError(`Temporary credential requires multi-factor authentication,` + ` but no MFA code callback was provided.`, false);
14
14
  }
15
15
  params.TokenCode = await options.mfaCodeProvider(params === null || params === void 0 ? void 0 : params.SerialNumber);
16
16
  }
17
+ const { AssumeRoleCommand, STSClient } = await Promise.resolve().then(() => __importStar(require("./loadSts")));
17
18
  if (!stsClient)
18
- stsClient = new client_sts_1.STSClient({ ...options.clientConfig, credentials: options.masterCredentials });
19
+ stsClient = new STSClient({ ...options.clientConfig, credentials: options.masterCredentials });
19
20
  if (options.clientPlugins) {
20
21
  for (const plugin of options.clientPlugins) {
21
22
  stsClient.middlewareStack.use(plugin);
22
23
  }
23
24
  }
24
- const { Credentials } = await stsClient.send(new client_sts_1.AssumeRoleCommand(params));
25
+ const { Credentials } = await stsClient.send(new AssumeRoleCommand(params));
25
26
  if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
26
27
  throw new property_provider_1.CredentialsProviderError(`Invalid response from STS.assumeRole call with role ${params.RoleArn}`);
27
28
  }
@@ -1,13 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fromTokenFile = void 0;
4
- const client_sts_1 = require("@aws-sdk/client-sts");
5
4
  const credential_provider_web_identity_1 = require("@aws-sdk/credential-provider-web-identity");
6
- const fromTokenFile = (init = {}) => {
7
- var _a;
8
- return (0, credential_provider_web_identity_1.fromTokenFile)({
9
- ...init,
10
- roleAssumerWithWebIdentity: (_a = init.roleAssumerWithWebIdentity) !== null && _a !== void 0 ? _a : (0, client_sts_1.getDefaultRoleAssumerWithWebIdentity)(init.clientConfig, init.clientPlugins),
11
- });
12
- };
5
+ const fromTokenFile = (init = {}) => (0, credential_provider_web_identity_1.fromTokenFile)({
6
+ ...init,
7
+ });
13
8
  exports.fromTokenFile = fromTokenFile;
@@ -1,13 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fromWebToken = void 0;
4
- const client_sts_1 = require("@aws-sdk/client-sts");
5
4
  const credential_provider_web_identity_1 = require("@aws-sdk/credential-provider-web-identity");
6
- const fromWebToken = (init) => {
7
- var _a;
8
- return (0, credential_provider_web_identity_1.fromWebToken)({
9
- ...init,
10
- roleAssumerWithWebIdentity: (_a = init.roleAssumerWithWebIdentity) !== null && _a !== void 0 ? _a : (0, client_sts_1.getDefaultRoleAssumerWithWebIdentity)(init.clientConfig, init.clientPlugins),
11
- });
12
- };
5
+ const fromWebToken = (init) => (0, credential_provider_web_identity_1.fromWebToken)({
6
+ ...init,
7
+ });
13
8
  exports.fromWebToken = fromWebToken;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.STSClient = exports.AssumeRoleCommand = void 0;
4
+ const client_sts_1 = require("@aws-sdk/client-sts");
5
+ Object.defineProperty(exports, "AssumeRoleCommand", { enumerable: true, get: function () { return client_sts_1.AssumeRoleCommand; } });
6
+ Object.defineProperty(exports, "STSClient", { enumerable: true, get: function () { return client_sts_1.STSClient; } });
@@ -1,6 +1,4 @@
1
- import { CognitoIdentityClient } from "@aws-sdk/client-cognito-identity";
2
1
  import { fromCognitoIdentity as _fromCognitoIdentity, } from "@aws-sdk/credential-provider-cognito-identity";
3
2
  export const fromCognitoIdentity = (options) => _fromCognitoIdentity({
4
3
  ...options,
5
- client: new CognitoIdentityClient(options.clientConfig ?? {}),
6
4
  });
@@ -1,6 +1,4 @@
1
- import { CognitoIdentityClient } from "@aws-sdk/client-cognito-identity";
2
1
  import { fromCognitoIdentityPool as _fromCognitoIdentityPool, } from "@aws-sdk/credential-provider-cognito-identity";
3
2
  export const fromCognitoIdentityPool = (options) => _fromCognitoIdentityPool({
4
3
  ...options,
5
- client: new CognitoIdentityClient(options.clientConfig ?? {}),
6
4
  });
@@ -1,2 +1,5 @@
1
1
  import { fromContainerMetadata as _fromContainerMetadata, } from "@smithy/credential-provider-imds";
2
- export const fromContainerMetadata = (init) => _fromContainerMetadata(init);
2
+ export const fromContainerMetadata = (init) => {
3
+ init?.logger?.debug("@smithy/credential-provider-imds", "fromContainerMetadata");
4
+ return _fromContainerMetadata(init);
5
+ };
@@ -1,2 +1,2 @@
1
1
  import { fromEnv as _fromEnv } from "@aws-sdk/credential-provider-env";
2
- export const fromEnv = () => _fromEnv();
2
+ export const fromEnv = (init) => _fromEnv(init);
@@ -1,7 +1,4 @@
1
- import { getDefaultRoleAssumer, getDefaultRoleAssumerWithWebIdentity } from "@aws-sdk/client-sts";
2
1
  import { fromIni as _fromIni } from "@aws-sdk/credential-provider-ini";
3
2
  export const fromIni = (init = {}) => _fromIni({
4
3
  ...init,
5
- roleAssumer: init.roleAssumer ?? getDefaultRoleAssumer(init.clientConfig, init.clientPlugins),
6
- roleAssumerWithWebIdentity: init.roleAssumerWithWebIdentity ?? getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins),
7
4
  });
@@ -1,2 +1,5 @@
1
1
  import { fromInstanceMetadata as _fromInstanceMetadata, } from "@smithy/credential-provider-imds";
2
- export const fromInstanceMetadata = (init) => _fromInstanceMetadata(init);
2
+ export const fromInstanceMetadata = (init) => {
3
+ init?.logger?.debug("@smithy/credential-provider-imds", "fromInstanceMetadata");
4
+ return _fromInstanceMetadata(init);
5
+ };
@@ -1,7 +1,4 @@
1
- import { getDefaultRoleAssumer, getDefaultRoleAssumerWithWebIdentity } from "@aws-sdk/client-sts";
2
1
  import { defaultProvider } from "@aws-sdk/credential-provider-node";
3
2
  export const fromNodeProviderChain = (init = {}) => defaultProvider({
4
3
  ...init,
5
- roleAssumer: init.roleAssumer ?? getDefaultRoleAssumer(init.clientConfig, init.clientPlugins),
6
- roleAssumerWithWebIdentity: init.roleAssumerWithWebIdentity ?? getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins),
7
4
  });
@@ -1,3 +1,4 @@
1
- import { SSOClient } from "@aws-sdk/client-sso";
2
1
  import { fromSSO as _fromSSO } from "@aws-sdk/credential-provider-sso";
3
- export const fromSSO = (init = {}) => _fromSSO({ ...{ ssoClient: init.clientConfig ? new SSOClient(init.clientConfig) : undefined }, ...init });
2
+ export const fromSSO = (init = {}) => {
3
+ return _fromSSO({ ...init });
4
+ };
@@ -1,8 +1,8 @@
1
- import { AssumeRoleCommand, STSClient } from "@aws-sdk/client-sts";
2
1
  import { CredentialsProviderError } from "@smithy/property-provider";
3
2
  export const fromTemporaryCredentials = (options) => {
4
3
  let stsClient;
5
4
  return async () => {
5
+ options.logger?.debug("@aws-sdk/credential-providers", "fromTemporaryCredentials (STS)");
6
6
  const params = { ...options.params, RoleSessionName: options.params.RoleSessionName ?? "aws-sdk-js-" + Date.now() };
7
7
  if (params?.SerialNumber) {
8
8
  if (!options.mfaCodeProvider) {
@@ -10,6 +10,7 @@ export const fromTemporaryCredentials = (options) => {
10
10
  }
11
11
  params.TokenCode = await options.mfaCodeProvider(params?.SerialNumber);
12
12
  }
13
+ const { AssumeRoleCommand, STSClient } = await import("./loadSts");
13
14
  if (!stsClient)
14
15
  stsClient = new STSClient({ ...options.clientConfig, credentials: options.masterCredentials });
15
16
  if (options.clientPlugins) {
@@ -1,6 +1,4 @@
1
- import { getDefaultRoleAssumerWithWebIdentity } from "@aws-sdk/client-sts";
2
- import { fromTokenFile as _fromTokenFile, } from "@aws-sdk/credential-provider-web-identity";
1
+ import { fromTokenFile as _fromTokenFile } from "@aws-sdk/credential-provider-web-identity";
3
2
  export const fromTokenFile = (init = {}) => _fromTokenFile({
4
3
  ...init,
5
- roleAssumerWithWebIdentity: init.roleAssumerWithWebIdentity ?? getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins),
6
4
  });
@@ -1,6 +1,4 @@
1
- import { getDefaultRoleAssumerWithWebIdentity } from "@aws-sdk/client-sts";
2
- import { fromWebToken as _fromWebToken, } from "@aws-sdk/credential-provider-web-identity";
1
+ import { fromWebToken as _fromWebToken } from "@aws-sdk/credential-provider-web-identity";
3
2
  export const fromWebToken = (init) => _fromWebToken({
4
3
  ...init,
5
- roleAssumerWithWebIdentity: init.roleAssumerWithWebIdentity ?? getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins),
6
4
  });
@@ -0,0 +1,2 @@
1
+ import { AssumeRoleCommand, STSClient } from "@aws-sdk/client-sts";
2
+ export { AssumeRoleCommand, STSClient };
@@ -1,4 +1,4 @@
1
- import { CognitoIdentityClientConfig } from "@aws-sdk/client-cognito-identity";
1
+ import type { CognitoIdentityClientConfig } from "@aws-sdk/client-cognito-identity";
2
2
  import { CognitoIdentityCredentialProvider as _CognitoIdentityCredentialProvider, FromCognitoIdentityParameters as _FromCognitoIdentityParameters } from "@aws-sdk/credential-provider-cognito-identity";
3
3
  export interface FromCognitoIdentityParameters extends Omit<_FromCognitoIdentityParameters, "client"> {
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { CognitoIdentityClientConfig } from "@aws-sdk/client-cognito-identity";
1
+ import type { CognitoIdentityClientConfig } from "@aws-sdk/client-cognito-identity";
2
2
  import { CognitoIdentityCredentialProvider, FromCognitoIdentityPoolParameters as _FromCognitoIdentityPoolParameters } from "@aws-sdk/credential-provider-cognito-identity";
3
3
  export interface FromCognitoIdentityPoolParameters extends Omit<_FromCognitoIdentityPoolParameters, "client"> {
4
4
  clientConfig?: CognitoIdentityClientConfig;
@@ -1,6 +1,7 @@
1
+ import type { CredentialProviderOptions } from "@aws-sdk/types";
1
2
  import { RemoteProviderInit as _RemoteProviderInit } from "@smithy/credential-provider-imds";
2
3
  import { AwsCredentialIdentityProvider } from "@smithy/types";
3
- export interface RemoteProviderInit extends _RemoteProviderInit {
4
+ export interface RemoteProviderInit extends _RemoteProviderInit, CredentialProviderOptions {
4
5
  }
5
6
  /**
6
7
  * Create a credential provider function that reads from ECS container metadata service.
@@ -1,3 +1,4 @@
1
+ import { FromEnvInit } from "@aws-sdk/credential-provider-env";
1
2
  import { AwsCredentialIdentityProvider } from "@smithy/types";
2
3
  /**
3
4
  * Create a credential provider that reads credentials from the following environment variables:
@@ -23,4 +24,4 @@ import { AwsCredentialIdentityProvider } from "@smithy/types";
23
24
  * });
24
25
  * ```
25
26
  */
26
- export declare const fromEnv: () => AwsCredentialIdentityProvider;
27
+ export declare const fromEnv: (init?: FromEnvInit) => AwsCredentialIdentityProvider;
@@ -1,10 +1,5 @@
1
- import { STSClientConfig } from "@aws-sdk/client-sts";
2
- import { FromIniInit as _FromIniInit } from "@aws-sdk/credential-provider-ini";
3
- import { AwsCredentialIdentityProvider, Pluggable } from "@smithy/types";
4
- export interface FromIniInit extends _FromIniInit {
5
- clientConfig?: STSClientConfig;
6
- clientPlugins?: Pluggable<any, any>[];
7
- }
1
+ import { FromIniInit } from "@aws-sdk/credential-provider-ini";
2
+ import { AwsCredentialIdentityProvider } from "@smithy/types";
8
3
  /**
9
4
  * Creates a credential provider function that reads from a shared credentials file at `~/.aws/credentials` and a
10
5
  * shared configuration file at `~/.aws/config`. Both files are expected to be INI formatted with section names
@@ -1,3 +1,4 @@
1
+ import type { CredentialProviderOptions } from "@aws-sdk/types";
1
2
  import { RemoteProviderConfig as _RemoteProviderInit } from "@smithy/credential-provider-imds";
2
3
  import { AwsCredentialIdentityProvider } from "@smithy/types";
3
4
  /**
@@ -19,4 +20,4 @@ import { AwsCredentialIdentityProvider } from "@smithy/types";
19
20
  * });
20
21
  * ```
21
22
  */
22
- export declare const fromInstanceMetadata: (init?: _RemoteProviderInit) => AwsCredentialIdentityProvider;
23
+ export declare const fromInstanceMetadata: (init?: _RemoteProviderInit & CredentialProviderOptions) => AwsCredentialIdentityProvider;
@@ -1,10 +1,5 @@
1
- import { STSClientConfig } from "@aws-sdk/client-sts";
2
1
  import { DefaultProviderInit } from "@aws-sdk/credential-provider-node";
3
- import { AwsCredentialIdentityProvider, Pluggable } from "@smithy/types";
4
- export interface fromNodeProviderChainInit extends DefaultProviderInit {
5
- clientConfig?: STSClientConfig;
6
- clientPlugins?: Pluggable<any, any>[];
7
- }
2
+ import type { AwsCredentialIdentityProvider } from "@smithy/types";
8
3
  /**
9
4
  * This is the same credential provider as {@link defaultProvider|the default provider for Node.js SDK},
10
5
  * but with default role assumers so you don't need to import them from
@@ -30,4 +25,4 @@ export interface fromNodeProviderChainInit extends DefaultProviderInit {
30
25
  * })
31
26
  * ```
32
27
  */
33
- export declare const fromNodeProviderChain: (init?: fromNodeProviderChainInit) => AwsCredentialIdentityProvider;
28
+ export declare const fromNodeProviderChain: (init?: DefaultProviderInit) => AwsCredentialIdentityProvider;
@@ -1,7 +1,5 @@
1
- import { FromProcessInit as _FromProcessInit } from "@aws-sdk/credential-provider-process";
1
+ import { FromProcessInit } from "@aws-sdk/credential-provider-process";
2
2
  import { AwsCredentialIdentityProvider } from "@smithy/types";
3
- export interface FromProcessInit extends _FromProcessInit {
4
- }
5
3
  /**
6
4
  * Creates a credential provider function that executes a given process and attempt to read its standard output to
7
5
  * receive a JSON payload containing the credentials.
@@ -1,9 +1,5 @@
1
- import { SSOClientConfig } from "@aws-sdk/client-sso";
2
- import { FromSSOInit as _FromSSOInit } from "@aws-sdk/credential-provider-sso";
1
+ import { FromSSOInit } from "@aws-sdk/credential-provider-sso";
3
2
  import { AwsCredentialIdentityProvider } from "@smithy/types";
4
- export interface FromSSOInit extends Omit<_FromSSOInit, "client"> {
5
- clientConfig?: SSOClientConfig;
6
- }
7
3
  /**
8
4
  * Creates a credential provider function that reads from the _resolved_ access token from local disk then requests
9
5
  * temporary AWS credentials.
@@ -1,6 +1,7 @@
1
- import { AssumeRoleCommandInput, STSClientConfig } from "@aws-sdk/client-sts";
1
+ import type { AssumeRoleCommandInput, STSClientConfig } from "@aws-sdk/client-sts";
2
+ import type { CredentialProviderOptions } from "@aws-sdk/types";
2
3
  import { AwsCredentialIdentity, AwsCredentialIdentityProvider, Pluggable } from "@smithy/types";
3
- export interface FromTemporaryCredentialsOptions {
4
+ export interface FromTemporaryCredentialsOptions extends CredentialProviderOptions {
4
5
  params: Omit<AssumeRoleCommandInput, "RoleSessionName"> & {
5
6
  RoleSessionName?: string;
6
7
  };
@@ -1,10 +1,5 @@
1
- import { STSClientConfig } from "@aws-sdk/client-sts";
2
- import { FromTokenFileInit as _FromTokenFileInit } from "@aws-sdk/credential-provider-web-identity";
3
- import { AwsCredentialIdentityProvider, Pluggable } from "@smithy/types";
4
- export interface FromTokenFileInit extends _FromTokenFileInit {
5
- clientConfig?: STSClientConfig;
6
- clientPlugins?: Pluggable<any, any>[];
7
- }
1
+ import { FromTokenFileInit } from "@aws-sdk/credential-provider-web-identity";
2
+ import type { AwsCredentialIdentityProvider } from "@smithy/types";
8
3
  /**
9
4
  * Creates a credential provider function that reads OIDC token from given file, then call STS.AssumeRoleWithWebIdentity
10
5
  * API. The configurations must be specified in environmental variables:
@@ -1,10 +1,5 @@
1
- import { STSClientConfig } from "@aws-sdk/client-sts";
2
- import { FromWebTokenInit as _FromWebTokenInit } from "@aws-sdk/credential-provider-web-identity";
3
- import { AwsCredentialIdentityProvider, Pluggable } from "@smithy/types";
4
- export interface FromWebTokenInit extends _FromWebTokenInit {
5
- clientConfig?: STSClientConfig;
6
- clientPlugins?: Pluggable<any, any>[];
7
- }
1
+ import { FromWebTokenInit } from "@aws-sdk/credential-provider-web-identity";
2
+ import type { AwsCredentialIdentityProvider } from "@smithy/types";
8
3
  /**
9
4
  * Creates a credential provider function that gets credentials calling STS
10
5
  * AssumeRoleWithWebIdentity API.
@@ -0,0 +1,2 @@
1
+ import { AssumeRoleCommand, STSClient } from "@aws-sdk/client-sts";
2
+ export { AssumeRoleCommand, STSClient };
@@ -1,6 +1,9 @@
1
+ import { CredentialProviderOptions } from "@aws-sdk/types";
1
2
  import { RemoteProviderInit as _RemoteProviderInit } from "@smithy/credential-provider-imds";
2
3
  import { AwsCredentialIdentityProvider } from "@smithy/types";
3
- export interface RemoteProviderInit extends _RemoteProviderInit {}
4
+ export interface RemoteProviderInit
5
+ extends _RemoteProviderInit,
6
+ CredentialProviderOptions {}
4
7
  export declare const fromContainerMetadata: (
5
8
  init?: RemoteProviderInit
6
9
  ) => AwsCredentialIdentityProvider;
@@ -1,2 +1,5 @@
1
+ import { FromEnvInit } from "@aws-sdk/credential-provider-env";
1
2
  import { AwsCredentialIdentityProvider } from "@smithy/types";
2
- export declare const fromEnv: () => AwsCredentialIdentityProvider;
3
+ export declare const fromEnv: (
4
+ init?: FromEnvInit
5
+ ) => AwsCredentialIdentityProvider;
@@ -1,10 +1,5 @@
1
- import { STSClientConfig } from "@aws-sdk/client-sts";
2
- import { FromIniInit as _FromIniInit } from "@aws-sdk/credential-provider-ini";
3
- import { AwsCredentialIdentityProvider, Pluggable } from "@smithy/types";
4
- export interface FromIniInit extends _FromIniInit {
5
- clientConfig?: STSClientConfig;
6
- clientPlugins?: Pluggable<any, any>[];
7
- }
1
+ import { FromIniInit } from "@aws-sdk/credential-provider-ini";
2
+ import { AwsCredentialIdentityProvider } from "@smithy/types";
8
3
  export declare const fromIni: (
9
4
  init?: FromIniInit
10
5
  ) => AwsCredentialIdentityProvider;
@@ -1,5 +1,6 @@
1
+ import { CredentialProviderOptions } from "@aws-sdk/types";
1
2
  import { RemoteProviderConfig as _RemoteProviderInit } from "@smithy/credential-provider-imds";
2
3
  import { AwsCredentialIdentityProvider } from "@smithy/types";
3
4
  export declare const fromInstanceMetadata: (
4
- init?: _RemoteProviderInit
5
+ init?: _RemoteProviderInit & CredentialProviderOptions
5
6
  ) => AwsCredentialIdentityProvider;
@@ -1,10 +1,5 @@
1
- import { STSClientConfig } from "@aws-sdk/client-sts";
2
1
  import { DefaultProviderInit } from "@aws-sdk/credential-provider-node";
3
- import { AwsCredentialIdentityProvider, Pluggable } from "@smithy/types";
4
- export interface fromNodeProviderChainInit extends DefaultProviderInit {
5
- clientConfig?: STSClientConfig;
6
- clientPlugins?: Pluggable<any, any>[];
7
- }
2
+ import { AwsCredentialIdentityProvider } from "@smithy/types";
8
3
  export declare const fromNodeProviderChain: (
9
- init?: fromNodeProviderChainInit
4
+ init?: DefaultProviderInit
10
5
  ) => AwsCredentialIdentityProvider;
@@ -1,6 +1,5 @@
1
- import { FromProcessInit as _FromProcessInit } from "@aws-sdk/credential-provider-process";
1
+ import { FromProcessInit } from "@aws-sdk/credential-provider-process";
2
2
  import { AwsCredentialIdentityProvider } from "@smithy/types";
3
- export interface FromProcessInit extends _FromProcessInit {}
4
3
  export declare const fromProcess: (
5
4
  init?: FromProcessInit
6
5
  ) => AwsCredentialIdentityProvider;
@@ -1,10 +1,5 @@
1
- import { SSOClientConfig } from "@aws-sdk/client-sso";
2
- import { FromSSOInit as _FromSSOInit } from "@aws-sdk/credential-provider-sso";
1
+ import { FromSSOInit } from "@aws-sdk/credential-provider-sso";
3
2
  import { AwsCredentialIdentityProvider } from "@smithy/types";
4
- export interface FromSSOInit
5
- extends Pick<_FromSSOInit, Exclude<keyof _FromSSOInit, "client">> {
6
- clientConfig?: SSOClientConfig;
7
- }
8
3
  export declare const fromSSO: (
9
4
  init?: FromSSOInit
10
5
  ) => AwsCredentialIdentityProvider;
@@ -1,10 +1,12 @@
1
1
  import { AssumeRoleCommandInput, STSClientConfig } from "@aws-sdk/client-sts";
2
+ import { CredentialProviderOptions } from "@aws-sdk/types";
2
3
  import {
3
4
  AwsCredentialIdentity,
4
5
  AwsCredentialIdentityProvider,
5
6
  Pluggable,
6
7
  } from "@smithy/types";
7
- export interface FromTemporaryCredentialsOptions {
8
+ export interface FromTemporaryCredentialsOptions
9
+ extends CredentialProviderOptions {
8
10
  params: Pick<
9
11
  AssumeRoleCommandInput,
10
12
  Exclude<keyof AssumeRoleCommandInput, "RoleSessionName">
@@ -1,10 +1,5 @@
1
- import { STSClientConfig } from "@aws-sdk/client-sts";
2
- import { FromTokenFileInit as _FromTokenFileInit } from "@aws-sdk/credential-provider-web-identity";
3
- import { AwsCredentialIdentityProvider, Pluggable } from "@smithy/types";
4
- export interface FromTokenFileInit extends _FromTokenFileInit {
5
- clientConfig?: STSClientConfig;
6
- clientPlugins?: Pluggable<any, any>[];
7
- }
1
+ import { FromTokenFileInit } from "@aws-sdk/credential-provider-web-identity";
2
+ import { AwsCredentialIdentityProvider } from "@smithy/types";
8
3
  export declare const fromTokenFile: (
9
4
  init?: FromTokenFileInit
10
5
  ) => AwsCredentialIdentityProvider;
@@ -1,10 +1,5 @@
1
- import { STSClientConfig } from "@aws-sdk/client-sts";
2
- import { FromWebTokenInit as _FromWebTokenInit } from "@aws-sdk/credential-provider-web-identity";
3
- import { AwsCredentialIdentityProvider, Pluggable } from "@smithy/types";
4
- export interface FromWebTokenInit extends _FromWebTokenInit {
5
- clientConfig?: STSClientConfig;
6
- clientPlugins?: Pluggable<any, any>[];
7
- }
1
+ import { FromWebTokenInit } from "@aws-sdk/credential-provider-web-identity";
2
+ import { AwsCredentialIdentityProvider } from "@smithy/types";
8
3
  export declare const fromWebToken: (
9
4
  init: FromWebTokenInit
10
5
  ) => AwsCredentialIdentityProvider;
@@ -0,0 +1,2 @@
1
+ import { AssumeRoleCommand, STSClient } from "@aws-sdk/client-sts";
2
+ export { AssumeRoleCommand, STSClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/credential-providers",
3
- "version": "3.499.0",
3
+ "version": "3.502.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",
@@ -28,18 +28,18 @@
28
28
  },
29
29
  "license": "Apache-2.0",
30
30
  "dependencies": {
31
- "@aws-sdk/client-cognito-identity": "3.499.0",
32
- "@aws-sdk/client-sso": "3.496.0",
33
- "@aws-sdk/client-sts": "3.499.0",
34
- "@aws-sdk/credential-provider-cognito-identity": "3.499.0",
35
- "@aws-sdk/credential-provider-env": "3.496.0",
36
- "@aws-sdk/credential-provider-http": "3.496.0",
37
- "@aws-sdk/credential-provider-ini": "3.496.0",
38
- "@aws-sdk/credential-provider-node": "3.499.0",
39
- "@aws-sdk/credential-provider-process": "3.496.0",
40
- "@aws-sdk/credential-provider-sso": "3.496.0",
41
- "@aws-sdk/credential-provider-web-identity": "3.496.0",
42
- "@aws-sdk/types": "3.496.0",
31
+ "@aws-sdk/client-cognito-identity": "3.502.0",
32
+ "@aws-sdk/client-sso": "3.502.0",
33
+ "@aws-sdk/client-sts": "3.502.0",
34
+ "@aws-sdk/credential-provider-cognito-identity": "3.502.0",
35
+ "@aws-sdk/credential-provider-env": "3.502.0",
36
+ "@aws-sdk/credential-provider-http": "3.502.0",
37
+ "@aws-sdk/credential-provider-ini": "3.502.0",
38
+ "@aws-sdk/credential-provider-node": "3.502.0",
39
+ "@aws-sdk/credential-provider-process": "3.502.0",
40
+ "@aws-sdk/credential-provider-sso": "3.502.0",
41
+ "@aws-sdk/credential-provider-web-identity": "3.502.0",
42
+ "@aws-sdk/types": "3.502.0",
43
43
  "@smithy/credential-provider-imds": "^2.2.1",
44
44
  "@smithy/property-provider": "^2.1.1",
45
45
  "@smithy/types": "^2.9.1",