@aws-sdk/credential-providers 3.504.0 → 3.504.1

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.
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.fromTemporaryCredentials = void 0;
4
27
  const property_provider_1 = require("@smithy/property-provider");
@@ -1,17 +1,45 @@
1
- import { CognitoIdentityClientConfig } from "@aws-sdk/client-cognito-identity";
2
- import {
3
- CognitoIdentityCredentialProvider as _CognitoIdentityCredentialProvider,
4
- FromCognitoIdentityParameters as _FromCognitoIdentityParameters,
5
- } from "@aws-sdk/credential-provider-cognito-identity";
6
- export interface FromCognitoIdentityParameters
7
- extends Pick<
8
- _FromCognitoIdentityParameters,
9
- Exclude<keyof _FromCognitoIdentityParameters, "client">
10
- > {
11
- clientConfig?: CognitoIdentityClientConfig;
12
- }
13
- export type CognitoIdentityCredentialProvider =
14
- _CognitoIdentityCredentialProvider;
15
- export declare const fromCognitoIdentity: (
16
- options: FromCognitoIdentityParameters
17
- ) => _CognitoIdentityCredentialProvider;
1
+ import { CognitoIdentityClientConfig } from "@aws-sdk/client-cognito-identity";
2
+ import { CognitoIdentityCredentialProvider as _CognitoIdentityCredentialProvider, FromCognitoIdentityParameters as _FromCognitoIdentityParameters } from "@aws-sdk/credential-provider-cognito-identity";
3
+ export interface FromCognitoIdentityParameters extends Pick<_FromCognitoIdentityParameters, Exclude<keyof _FromCognitoIdentityParameters, "client">> {
4
+ /**
5
+ * Custom client configuration if you need overwrite default Cognito Identity client configuration.
6
+ */
7
+ clientConfig?: CognitoIdentityClientConfig;
8
+ }
9
+ export type CognitoIdentityCredentialProvider = _CognitoIdentityCredentialProvider;
10
+ /**
11
+ * Creates a credential provider function that reetrieves temporary AWS credentials using Amazon Cognito's
12
+ * `GetCredentialsForIdentity` operation.
13
+ *
14
+ * Results from this function call are not cached internally.
15
+ *
16
+ * ```javascript
17
+ * import { fromCognitoIdentity } from "@aws-sdk/credential-providers"; // ES6 import
18
+ * // const { fromCognitoIdentity } = require("@aws-sdk/credential-providers"); // CommonJS import
19
+ *
20
+ * const client = new FooClient({
21
+ * region,
22
+ * credentials: fromCognitoIdentity({
23
+ * // Required. The unique identifier for the identity against which credentials
24
+ * // will be issued.
25
+ * identityId: "us-east-1:128d0a74-c82f-4553-916d-90053e4a8b0f"
26
+ * // optional. The ARN of the role to be assumed when multiple roles were
27
+ * // received in the token from the identity provider.
28
+ * customRoleArn: "arn:aws:iam::1234567890:role/MYAPP-CognitoIdentity"
29
+ * // Optional. A set of name-value pairs that map provider names to provider
30
+ * // tokens. Required when using identities associated with external identity
31
+ * // providers such as Facebook.
32
+ * logins: {
33
+ * "graph.facebook.com": "FBTOKEN",
34
+ * "www.amazon.com": "AMAZONTOKEN",
35
+ * "accounts.google.com": "GOOGLETOKEN",
36
+ * "api.twitter.com": "TWITTERTOKEN'",
37
+ * "www.digits.com": "DIGITSTOKEN"
38
+ * },
39
+ * // Optional. Custom client configuration if you need overwrite default Cognito Identity client configuration.
40
+ * clientConfig: { region }
41
+ * }),
42
+ * });
43
+ * ```
44
+ */
45
+ export declare const fromCognitoIdentity: (options: FromCognitoIdentityParameters) => _CognitoIdentityCredentialProvider;
@@ -1,15 +1,46 @@
1
- import { CognitoIdentityClientConfig } from "@aws-sdk/client-cognito-identity";
2
- import {
3
- CognitoIdentityCredentialProvider,
4
- FromCognitoIdentityPoolParameters as _FromCognitoIdentityPoolParameters,
5
- } from "@aws-sdk/credential-provider-cognito-identity";
6
- export interface FromCognitoIdentityPoolParameters
7
- extends Pick<
8
- _FromCognitoIdentityPoolParameters,
9
- Exclude<keyof _FromCognitoIdentityPoolParameters, "client">
10
- > {
11
- clientConfig?: CognitoIdentityClientConfig;
12
- }
13
- export declare const fromCognitoIdentityPool: (
14
- options: FromCognitoIdentityPoolParameters
15
- ) => CognitoIdentityCredentialProvider;
1
+ import { CognitoIdentityClientConfig } from "@aws-sdk/client-cognito-identity";
2
+ import { CognitoIdentityCredentialProvider, FromCognitoIdentityPoolParameters as _FromCognitoIdentityPoolParameters } from "@aws-sdk/credential-provider-cognito-identity";
3
+ export interface FromCognitoIdentityPoolParameters extends Pick<_FromCognitoIdentityPoolParameters, Exclude<keyof _FromCognitoIdentityPoolParameters, "client">> {
4
+ clientConfig?: CognitoIdentityClientConfig;
5
+ }
6
+ /**
7
+ * Creates a credential provider function that retrieves or generates a unique identifier using Amazon Cognito's `GetId`
8
+ * operation, then generates temporary AWS credentials using Amazon Cognito's `GetCredentialsForIdentity` operation.
9
+ *
10
+ * Results from `GetId` are cached internally, but results from `GetCredentialsForIdentity` are not.
11
+ *
12
+ * ```javascript
13
+ * import { fromCognitoIdentityPool } from "@aws-sdk/credential-providers"; // ES6 import
14
+ * // const { fromCognitoIdentityPool } = require("@aws-sdk/credential-providers"); // CommonJS import
15
+ *
16
+ * const client = new FooClient({
17
+ * region,
18
+ * credentials: fromCognitoIdentityPool({
19
+ * // Required. The unique identifier for the identity pool from which an identity should be retrieved or generated.
20
+ * identityPoolId: "us-east-1:1699ebc0-7900-4099-b910-2df94f52a030";
21
+ * // Optional. A standard AWS account ID (9+ digits)
22
+ * accountId: "123456789",
23
+ * // Optional. A cache in which to store resolved Cognito IdentityIds.
24
+ * cache: custom_storage,
25
+ * // Optional. A unique identifier for the user used to cache Cognito IdentityIds on a per-user basis.
26
+ * userIdentifier: "user_0",
27
+ * // optional. The ARN of the role to be assumed when multiple roles were
28
+ * // received in the token from the identity provider.
29
+ * customRoleArn: "arn:aws:iam::1234567890:role/MYAPP-CognitoIdentity"
30
+ * // Optional. A set of name-value pairs that map provider names to provider
31
+ * // tokens. Required when using identities associated with external identity
32
+ * // providers such as Facebook.
33
+ * logins: {
34
+ * 'graph.facebook.com': 'FBTOKEN',
35
+ * 'www.amazon.com': 'AMAZONTOKEN',
36
+ * 'accounts.google.com': 'GOOGLETOKEN',
37
+ * 'api.twitter.com': 'TWITTERTOKEN',
38
+ * 'www.digits.com': 'DIGITSTOKEN'
39
+ * },
40
+ * // Optional. Custom client configuration if you need overwrite default Cognito Identity client configuration.
41
+ * client: new CognitoIdentityClient({ region })
42
+ * }),
43
+ * });
44
+ * ```
45
+ */
46
+ export declare const fromCognitoIdentityPool: (options: FromCognitoIdentityPoolParameters) => CognitoIdentityCredentialProvider;
@@ -1,9 +1,25 @@
1
- import { CredentialProviderOptions } from "@aws-sdk/types";
2
- import { RemoteProviderInit as _RemoteProviderInit } from "@smithy/credential-provider-imds";
3
- import { AwsCredentialIdentityProvider } from "@smithy/types";
4
- export interface RemoteProviderInit
5
- extends _RemoteProviderInit,
6
- CredentialProviderOptions {}
7
- export declare const fromContainerMetadata: (
8
- init?: RemoteProviderInit
9
- ) => AwsCredentialIdentityProvider;
1
+ import { CredentialProviderOptions } from "@aws-sdk/types";
2
+ import { RemoteProviderInit as _RemoteProviderInit } from "@smithy/credential-provider-imds";
3
+ import { AwsCredentialIdentityProvider } from "@smithy/types";
4
+ export interface RemoteProviderInit extends _RemoteProviderInit, CredentialProviderOptions {
5
+ }
6
+ /**
7
+ * Create a credential provider function that reads from ECS container metadata service.
8
+ *
9
+ * ```javascript
10
+ * import { fromContainerMetadata } from "@aws-sdk/credential-providers"; // ES6 import
11
+ * // const { fromContainerMetadata } = require("@aws-sdk/credential-providers"); // CommonJS import
12
+ *
13
+ * const foo = new FooClient({
14
+ * credentials: fromContainerMetadata({
15
+ * // Optional. The connection timeout (in milliseconds) to apply to any remote requests. If not specified, a default value
16
+ * // of`1000` (one second) is used.
17
+ * timeout: 1000,
18
+ * // Optional. The maximum number of times any HTTP connections should be retried. If not specified, a default value of `0`
19
+ * // will be used.
20
+ * maxRetries: 0,
21
+ * }),
22
+ * });
23
+ * ```
24
+ */
25
+ export declare const fromContainerMetadata: (init?: RemoteProviderInit) => AwsCredentialIdentityProvider;
@@ -1,5 +1,27 @@
1
- import { FromEnvInit } from "@aws-sdk/credential-provider-env";
2
- import { AwsCredentialIdentityProvider } from "@smithy/types";
3
- export declare const fromEnv: (
4
- init?: FromEnvInit
5
- ) => AwsCredentialIdentityProvider;
1
+ import { FromEnvInit } from "@aws-sdk/credential-provider-env";
2
+ import { AwsCredentialIdentityProvider } from "@smithy/types";
3
+ /**
4
+ * Create a credential provider that reads credentials from the following environment variables:
5
+ *
6
+ * - `AWS_ACCESS_KEY_ID` - The access key for your AWS account.
7
+ * - `AWS_SECRET_ACCESS_KEY` - The secret key for your AWS account.
8
+ * - `AWS_SESSION_TOKEN` - The session key for your AWS account. This is only
9
+ * needed when you are using temporary credentials.
10
+ * - `AWS_CREDENTIAL_EXPIRATION` - The expiration time of the credentials contained
11
+ * in the environment variables described above. This value must be in a format
12
+ * compatible with the [ISO-8601 standard](https://en.wikipedia.org/wiki/ISO_8601)
13
+ * and is only needed when you are using temporary credentials.
14
+ *
15
+ * If either the `AWS_ACCESS_KEY_ID` or `AWS_SECRET_ACCESS_KEY` environment variable is not set or contains a falsy
16
+ * value, the promise returned by the `fromEnv` function will be rejected.
17
+ *
18
+ * ```javascript
19
+ * import { fromEnv } from "@aws-sdk/credential-providers"; // ES6 import
20
+ * // const { fromEnv } = require("@aws-sdk/credential-providers"); // CommonJS import
21
+ *
22
+ * const client = new DynamoDBClient({
23
+ * credentials: fromEnv(),
24
+ * });
25
+ * ```
26
+ */
27
+ export declare const fromEnv: (init?: FromEnvInit) => AwsCredentialIdentityProvider;
@@ -1,5 +1,42 @@
1
- import { FromIniInit } from "@aws-sdk/credential-provider-ini";
2
- import { AwsCredentialIdentityProvider } from "@smithy/types";
3
- export declare const fromIni: (
4
- init?: FromIniInit
5
- ) => AwsCredentialIdentityProvider;
1
+ import { FromIniInit } from "@aws-sdk/credential-provider-ini";
2
+ import { AwsCredentialIdentityProvider } from "@smithy/types";
3
+ /**
4
+ * Creates a credential provider function that reads from a shared credentials file at `~/.aws/credentials` and a
5
+ * shared configuration file at `~/.aws/config`. Both files are expected to be INI formatted with section names
6
+ * corresponding to profiles. Sections in the credentials file are treated as profile names, whereas profile sections in
7
+ * the config file must have the format of`[profile profile-name]`, except for the default profile.
8
+ *
9
+ * Profiles that appear in both files will not be merged, and the version that appears in the credentials file will be
10
+ * given precedence over the profile found in the config file.
11
+ *
12
+ * ```javascript
13
+ * import { fromIni } from "@aws-sdk/credential-providers"; // ES6 import
14
+ * // const { fromIni } = require("@aws-sdk/credential-providers"); // CommonJS import
15
+ *
16
+ * const client = new FooClient({
17
+ * credentials: fromIni({
18
+ * // Optional. The configuration profile to use. If not specified, the provider will use the value in the
19
+ * // `AWS_PROFILE` environment variable or a default of `default`.
20
+ * profile: "profile",
21
+ * // Optional. The path to the shared credentials file. If not specified, the provider will use the value in the
22
+ * // `AWS_SHARED_CREDENTIALS_FILE` environment variable or a default of `~/.aws/credentials`.
23
+ * filepath: "~/.aws/credentials",
24
+ * // Optional. The path to the shared config file. If not specified, the provider will use the value in the
25
+ * // `AWS_CONFIG_FILE` environment variable or a default of `~/.aws/config`.
26
+ * configFilepath: "~/.aws/config",
27
+ * // Optional. A function that returns a a promise fulfilled with an MFA token code for the provided MFA Serial
28
+ * // code. If a profile requires an MFA code and `mfaCodeProvider` is not a valid function, the credential provider
29
+ * // promise will be rejected.
30
+ * mfaCodeProvider: async (mfaSerial) => {
31
+ * return "token";
32
+ * },
33
+ * // Optional. Custom STS client configurations overriding the default ones.
34
+ * clientConfig: { region },
35
+ * // Optional. Custom STS client middleware plugin to modify the client default behavior.
36
+ * // e.g. adding custom headers.
37
+ * clientPlugins: [addFooHeadersPlugin],
38
+ * }),
39
+ * });
40
+ * ```
41
+ */
42
+ export declare const fromIni: (init?: FromIniInit) => AwsCredentialIdentityProvider;
@@ -1,6 +1,23 @@
1
- import { CredentialProviderOptions } from "@aws-sdk/types";
2
- import { RemoteProviderConfig as _RemoteProviderInit } from "@smithy/credential-provider-imds";
3
- import { AwsCredentialIdentityProvider } from "@smithy/types";
4
- export declare const fromInstanceMetadata: (
5
- init?: _RemoteProviderInit & CredentialProviderOptions
6
- ) => AwsCredentialIdentityProvider;
1
+ import { CredentialProviderOptions } from "@aws-sdk/types";
2
+ import { RemoteProviderConfig as _RemoteProviderInit } from "@smithy/credential-provider-imds";
3
+ import { AwsCredentialIdentityProvider } from "@smithy/types";
4
+ /**
5
+ * Creates a credential provider function that reads from the EC2 instance metadata service.
6
+ *
7
+ * ```javascript
8
+ * import { fromInstanceMetadata } from "@aws-sdk/credential-providers"; // ES6 import
9
+ * // const { fromInstanceMetadata } = require("@aws-sdk/credential-providers"); // CommonJS import
10
+ *
11
+ * const client = new DynamoDBClient({
12
+ * credentials: fromInstanceMetadata({
13
+ * // Optional. The connection timeout (in milliseconds) to apply to any remote requests. If not specified, a
14
+ * // default value of`1000` (one second) is used.
15
+ * timeout: 1000,
16
+ * // Optional. The maximum number of times any HTTP connections should be retried. If not specified, a default
17
+ * // value of `0` will be used.
18
+ * maxRetries: 0,
19
+ * }),
20
+ * });
21
+ * ```
22
+ */
23
+ export declare const fromInstanceMetadata: (init?: _RemoteProviderInit & CredentialProviderOptions) => AwsCredentialIdentityProvider;
@@ -1,5 +1,28 @@
1
- import { DefaultProviderInit } from "@aws-sdk/credential-provider-node";
2
- import { AwsCredentialIdentityProvider } from "@smithy/types";
3
- export declare const fromNodeProviderChain: (
4
- init?: DefaultProviderInit
5
- ) => AwsCredentialIdentityProvider;
1
+ import { DefaultProviderInit } from "@aws-sdk/credential-provider-node";
2
+ import { AwsCredentialIdentityProvider } from "@smithy/types";
3
+ /**
4
+ * This is the same credential provider as {@link defaultProvider|the default provider for Node.js SDK},
5
+ * but with default role assumers so you don't need to import them from
6
+ * STS client and supply them manually.
7
+ *
8
+ * You normally don't need to use this explicitly in the client constructor.
9
+ * It is useful for utility functions requiring credentials like S3 presigner,
10
+ * or RDS signer.
11
+ *
12
+ * ```js
13
+ * import { fromNodeProviderChain } from "@aws-sdk/credential-providers"; // ES6 import
14
+ * // const { fromNodeProviderChain } = require("@aws-sdk/credential-providers") // CommonJS import
15
+ *
16
+ * const credentialProvider = fromNodeProviderChain({
17
+ * //...any input of fromEnv(), fromSSO(), fromTokenFile(), fromIni(),
18
+ * // fromProcess(), fromInstanceMetadata(), fromContainerMetadata()
19
+ *
20
+ * // Optional. Custom STS client configurations overriding the default ones.
21
+ * clientConfig: { region },
22
+ * // Optional. Custom STS client middleware plugin to modify the client default behavior.
23
+ * // e.g. adding custom headers.
24
+ * clientPlugins: [addFooHeadersPlugin],
25
+ * })
26
+ * ```
27
+ */
28
+ export declare const fromNodeProviderChain: (init?: DefaultProviderInit) => AwsCredentialIdentityProvider;
@@ -1,5 +1,26 @@
1
- import { FromProcessInit } from "@aws-sdk/credential-provider-process";
2
- import { AwsCredentialIdentityProvider } from "@smithy/types";
3
- export declare const fromProcess: (
4
- init?: FromProcessInit
5
- ) => AwsCredentialIdentityProvider;
1
+ import { FromProcessInit } from "@aws-sdk/credential-provider-process";
2
+ import { AwsCredentialIdentityProvider } from "@smithy/types";
3
+ /**
4
+ * Creates a credential provider function that executes a given process and attempt to read its standard output to
5
+ * receive a JSON payload containing the credentials.
6
+ *
7
+ * ```javascript
8
+ * import { fromProcess } from "@aws-sdk/credential-providers"; // ES6 import
9
+ * // const { fromProcess } = require("@aws-sdk/credential-providers"); // CommonJS import
10
+ *
11
+ * const client = new FooClient({
12
+ * credentials: fromProcess({
13
+ * // Optional. The configuration profile to use. If not specified, the provider will use the value in the
14
+ * // `AWS_PROFILE` environment variable or a default of `default`.
15
+ * profile: "profile",
16
+ * // Optional. The path to the shared credentials file. If not specified, the provider will use the value in the
17
+ * // `AWS_SHARED_CREDENTIALS_FILE` environment variable or a default of `~/.aws/credentials`.
18
+ * filepath: "~/.aws/credentials",
19
+ * // Optional. The path to the shared config file. If not specified, the provider will use the value in the
20
+ * // `AWS_CONFIG_FILE` environment variable or a default of `~/.aws/config`.
21
+ * configFilepath: "~/.aws/config",
22
+ * }),
23
+ * });
24
+ * ```
25
+ */
26
+ export declare const fromProcess: (init?: FromProcessInit) => AwsCredentialIdentityProvider;
@@ -1,5 +1,44 @@
1
- import { FromSSOInit } from "@aws-sdk/credential-provider-sso";
2
- import { AwsCredentialIdentityProvider } from "@smithy/types";
3
- export declare const fromSSO: (
4
- init?: FromSSOInit
5
- ) => AwsCredentialIdentityProvider;
1
+ import { FromSSOInit } from "@aws-sdk/credential-provider-sso";
2
+ import { AwsCredentialIdentityProvider } from "@smithy/types";
3
+ /**
4
+ * Creates a credential provider function that reads from the _resolved_ access token from local disk then requests
5
+ * temporary AWS credentials.
6
+ *
7
+ * You can create the `AwsCredentialIdentityProvider` functions using the inline SSO parameters(`ssoStartUrl`, `ssoAccountId`,
8
+ * `ssoRegion`, `ssoRoleName`) or load them from [AWS SDKs and Tools shared configuration and credentials files](https://docs.aws.amazon.com/credref/latest/refdocs/creds-config-files.html).
9
+ * Profiles in the `credentials` file are given precedence over profiles in the `config` file.
10
+ *
11
+ * ```javascript
12
+ * import { fromSSO } from "@aws-sdk/credential-providers"; // ES6 import
13
+ * // const { fromSSO } = require(@aws-sdk/credential-providers") // CommonJS import
14
+ *
15
+ * const client = new FooClient({
16
+ * credentials: fromSSO({
17
+ * // Optional. The configuration profile to use. If not specified, the provider will use the value in the
18
+ * // `AWS_PROFILE` environment variable or `default` by default.
19
+ * profile: "my-sso-profile",
20
+ * // Optional. The path to the shared credentials file. If not specified, the provider will use the value in the
21
+ * // `AWS_SHARED_CREDENTIALS_FILE` environment variable or a default of `~/.aws/credentials`.
22
+ * filepath: "~/.aws/credentials",
23
+ * // Optional. The path to the shared config file. If not specified, the provider will use the value in the
24
+ * // `AWS_CONFIG_FILE` environment variable or a default of `~/.aws/config`.
25
+ * configFilepath: "~/.aws/config",
26
+ * // Optional. The URL to the AWS SSO service. Required if any of the `sso*` options(except for `ssoClient`) is
27
+ * // provided.
28
+ * ssoStartUrl: "https://d-abc123.awsapps.com/start",
29
+ * // Optional. The ID of the AWS account to use for temporary credentials. Required if any of the `sso*`
30
+ * // options(except for `ssoClient`) is provided.
31
+ * ssoAccountId: "1234567890",
32
+ * // Optional. The AWS region to use for temporary credentials. Required if any of the `sso*` options(except for
33
+ * // `ssoClient`) is provided.
34
+ * ssoRegion: "us-east-1",
35
+ * // Optional. The name of the AWS role to assume. Required if any of the `sso*` options(except for `ssoClient`) is
36
+ * // provided.
37
+ * ssoRoleName: "SampleRole",
38
+ * // Optional. Overwrite the configuration used construct the SSO service client.
39
+ * clientConfig: { region },
40
+ * }),
41
+ * });
42
+ * ```
43
+ */
44
+ export declare const fromSSO: (init?: FromSSOInit) => AwsCredentialIdentityProvider;
@@ -1,23 +1,53 @@
1
- import { AssumeRoleCommandInput, STSClientConfig } from "@aws-sdk/client-sts";
2
- import { CredentialProviderOptions } from "@aws-sdk/types";
3
- import {
4
- AwsCredentialIdentity,
5
- AwsCredentialIdentityProvider,
6
- Pluggable,
7
- } from "@smithy/types";
8
- export interface FromTemporaryCredentialsOptions
9
- extends CredentialProviderOptions {
10
- params: Pick<
11
- AssumeRoleCommandInput,
12
- Exclude<keyof AssumeRoleCommandInput, "RoleSessionName">
13
- > & {
14
- RoleSessionName?: string;
15
- };
16
- masterCredentials?: AwsCredentialIdentity | AwsCredentialIdentityProvider;
17
- clientConfig?: STSClientConfig;
18
- clientPlugins?: Pluggable<any, any>[];
19
- mfaCodeProvider?: (mfaSerial: string) => Promise<string>;
20
- }
21
- export declare const fromTemporaryCredentials: (
22
- options: FromTemporaryCredentialsOptions
23
- ) => AwsCredentialIdentityProvider;
1
+ import { AssumeRoleCommandInput, STSClientConfig } from "@aws-sdk/client-sts";
2
+ import { CredentialProviderOptions } from "@aws-sdk/types";
3
+ import { AwsCredentialIdentity, AwsCredentialIdentityProvider, Pluggable } from "@smithy/types";
4
+ export interface FromTemporaryCredentialsOptions extends CredentialProviderOptions {
5
+ params: Pick<AssumeRoleCommandInput, Exclude<keyof AssumeRoleCommandInput, "RoleSessionName">> & {
6
+ RoleSessionName?: string;
7
+ };
8
+ masterCredentials?: AwsCredentialIdentity | AwsCredentialIdentityProvider;
9
+ clientConfig?: STSClientConfig;
10
+ clientPlugins?: Pluggable<any, any>[];
11
+ mfaCodeProvider?: (mfaSerial: string) => Promise<string>;
12
+ }
13
+ /**
14
+ * Creates a credential provider function that retrieves temporary credentials from STS AssumeRole API.
15
+ *
16
+ * ```javascript
17
+ * import { fromTemporaryCredentials } from "@aws-sdk/credential-providers"; // ES6 import
18
+ * // const { fromTemporaryCredentials } = require("@aws-sdk/credential-providers"); // CommonJS import
19
+ *
20
+ * const client = new FooClient({
21
+ * region,
22
+ * credentials: fromTemporaryCredentials(
23
+ * // Optional. The master credentials used to get and refresh temporary credentials from AWS STS. If skipped, it uses
24
+ * // the default credential resolved by internal STS client.
25
+ * masterCredentials: fromTemporaryCredentials({
26
+ * params: { RoleArn: "arn:aws:iam::1234567890:role/RoleA" }
27
+ * }),
28
+ * // Required. Options passed to STS AssumeRole operation.
29
+ * params: {
30
+ * // Required. ARN of role to assume.
31
+ * RoleArn: "arn:aws:iam::1234567890:role/RoleB",
32
+ * // Optional. An identifier for the assumed role session. If skipped, it generates a random session name with
33
+ * // prefix of 'aws-sdk-js-'.
34
+ * RoleSessionName: "aws-sdk-js-123",
35
+ * // Optional. The duration, in seconds, of the role session.
36
+ * DurationSeconds: 3600
37
+ * //... For more options see https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html
38
+ * },
39
+ * // Optional. Custom STS client configurations overriding the default ones.
40
+ * clientConfig: { region },
41
+ * // Optional. Custom STS client middleware plugin to modify the client default behavior.
42
+ * // e.g. adding custom headers.
43
+ * clientPlugins: [addFooHeadersPlugin],
44
+ * // Optional. A function that returns a promise fulfilled with an MFA token code for the provided MFA Serial code.
45
+ * // Required if `params` has `SerialNumber` config.
46
+ * mfaCodeProvider: async mfaSerial => {
47
+ * return "token"
48
+ * }
49
+ * ),
50
+ * });
51
+ * ```
52
+ */
53
+ export declare const fromTemporaryCredentials: (options: FromTemporaryCredentialsOptions) => AwsCredentialIdentityProvider;
@@ -1,5 +1,31 @@
1
- import { FromTokenFileInit } from "@aws-sdk/credential-provider-web-identity";
2
- import { AwsCredentialIdentityProvider } from "@smithy/types";
3
- export declare const fromTokenFile: (
4
- init?: FromTokenFileInit
5
- ) => AwsCredentialIdentityProvider;
1
+ import { FromTokenFileInit } from "@aws-sdk/credential-provider-web-identity";
2
+ import { AwsCredentialIdentityProvider } from "@smithy/types";
3
+ /**
4
+ * Creates a credential provider function that reads OIDC token from given file, then call STS.AssumeRoleWithWebIdentity
5
+ * API. The configurations must be specified in environmental variables:
6
+ *
7
+ * - Reads file location of where the OIDC token is stored from either provided option `webIdentityTokenFile` or
8
+ * environment variable `AWS_WEB_IDENTITY_TOKEN_FILE`.
9
+ * - Reads IAM role wanting to be assumed from either provided option `roleArn` or environment variable `AWS_ROLE_ARN`.
10
+ * - Reads optional role session name to be used to distinguish sessions from provided option `roleSessionName` or
11
+ * environment variable `AWS_ROLE_SESSION_NAME`.
12
+ * If session name is not defined, it comes up with a role session name.
13
+ * - Reads OIDC token from file on disk.
14
+ * - Calls sts:AssumeRoleWithWebIdentity via `roleAssumerWithWebIdentity` option to get credentials.
15
+ *
16
+ * ```javascript
17
+ * import { fromTokenFile } from "@aws-sdk/credential-providers"; // ES6 import
18
+ * // const { fromTokenFile } = require("@aws-sdk/credential-providers"); // CommonJS import
19
+ *
20
+ * const client = new FooClient({
21
+ * credentials: fromTokenFile({
22
+ * // Optional. STS client config to make the assume role request.
23
+ * clientConfig: { region }
24
+ * // Optional. Custom STS client middleware plugin to modify the client default behavior.
25
+ * // e.g. adding custom headers.
26
+ * clientPlugins: [addFooHeadersPlugin],
27
+ * });
28
+ * });
29
+ * ```
30
+ */
31
+ export declare const fromTokenFile: (init?: FromTokenFileInit) => AwsCredentialIdentityProvider;
@@ -1,5 +1,40 @@
1
- import { FromWebTokenInit } from "@aws-sdk/credential-provider-web-identity";
2
- import { AwsCredentialIdentityProvider } from "@smithy/types";
3
- export declare const fromWebToken: (
4
- init: FromWebTokenInit
5
- ) => AwsCredentialIdentityProvider;
1
+ import { FromWebTokenInit } from "@aws-sdk/credential-provider-web-identity";
2
+ import { AwsCredentialIdentityProvider } from "@smithy/types";
3
+ /**
4
+ * Creates a credential provider function that gets credentials calling STS
5
+ * AssumeRoleWithWebIdentity API.
6
+ *
7
+ * ```javascript
8
+ * import { fromWebToken } from "@aws-sdk/credential-providers"; // ES6 import
9
+ * // const { fromWebToken } = require("@aws-sdk/credential-providers"); // CommonJS import
10
+ *
11
+ * const dynamodb = new DynamoDBClient({
12
+ * region,
13
+ * credentials: fromWebToken({
14
+ * // Required. ARN of the role that the caller is assuming.
15
+ * roleArn: "arn:aws:iam::1234567890:role/RoleA",
16
+ * // Required. The OAuth 2.0 access token or OpenID Connect ID token that is provided by the identity provider.
17
+ * webIdentityToken: await openIdProvider()
18
+ * // Optional. Custom STS client configurations overriding the default ones.
19
+ * clientConfig: { region }
20
+ * // Optional. Custom STS client middleware plugin to modify the client default behavior.
21
+ * // e.g. adding custom headers.
22
+ * clientPlugins: [addFooHeadersPlugin],
23
+ * // Optional. A function that assumes a role with web identity and returns a promise fulfilled with credentials for
24
+ * // the assumed role.
25
+ * roleAssumerWithWebIdentity,
26
+ * // Optional. An identifier for the assumed role session.
27
+ * roleSessionName: "session_123",
28
+ * // Optional. The fully qualified host component of the domain name of the identity provider.
29
+ * providerId: "graph.facebook.com",
30
+ * // Optional. ARNs of the IAM managed policies that you want to use as managed session.
31
+ * policyArns: [{arn: "arn:aws:iam::1234567890:policy/SomePolicy"}],
32
+ * // Optional. An IAM policy in JSON format that you want to use as an inline session policy.
33
+ * policy: "JSON_STRING",
34
+ * // Optional. The duration, in seconds, of the role session. Default to 3600.
35
+ * durationSeconds: 7200
36
+ * }),
37
+ * });
38
+ * ```
39
+ */
40
+ export declare const fromWebToken: (init: FromWebTokenInit) => AwsCredentialIdentityProvider;
@@ -1,9 +1,6 @@
1
- export * from "./fromCognitoIdentity";
2
- export * from "./fromCognitoIdentityPool";
3
- export { fromHttp } from "@aws-sdk/credential-provider-http";
4
- export {
5
- FromHttpOptions,
6
- HttpProviderCredentials,
7
- } from "@aws-sdk/credential-provider-http";
8
- export * from "./fromTemporaryCredentials";
9
- export * from "./fromWebToken";
1
+ export * from "./fromCognitoIdentity";
2
+ export * from "./fromCognitoIdentityPool";
3
+ export { fromHttp } from "@aws-sdk/credential-provider-http";
4
+ export { FromHttpOptions, HttpProviderCredentials } from "@aws-sdk/credential-provider-http";
5
+ export * from "./fromTemporaryCredentials";
6
+ export * from "./fromWebToken";
@@ -1,17 +1,13 @@
1
- export * from "./fromCognitoIdentity";
2
- export * from "./fromCognitoIdentityPool";
3
- export * from "./fromContainerMetadata";
4
- export * from "./fromEnv";
5
- export {
6
- fromHttp,
7
- FromHttpOptions,
8
- HttpProviderCredentials,
9
- } from "@aws-sdk/credential-provider-http";
10
- export * from "./fromIni";
11
- export * from "./fromInstanceMetadata";
12
- export * from "./fromNodeProviderChain";
13
- export * from "./fromProcess";
14
- export * from "./fromSSO";
15
- export * from "./fromTemporaryCredentials";
16
- export * from "./fromTokenFile";
17
- export * from "./fromWebToken";
1
+ export * from "./fromCognitoIdentity";
2
+ export * from "./fromCognitoIdentityPool";
3
+ export * from "./fromContainerMetadata";
4
+ export * from "./fromEnv";
5
+ export { fromHttp, FromHttpOptions, HttpProviderCredentials } from "@aws-sdk/credential-provider-http";
6
+ export * from "./fromIni";
7
+ export * from "./fromInstanceMetadata";
8
+ export * from "./fromNodeProviderChain";
9
+ export * from "./fromProcess";
10
+ export * from "./fromSSO";
11
+ export * from "./fromTemporaryCredentials";
12
+ export * from "./fromTokenFile";
13
+ export * from "./fromWebToken";
@@ -1,2 +1,2 @@
1
- import { AssumeRoleCommand, STSClient } from "@aws-sdk/client-sts";
2
- export { AssumeRoleCommand, STSClient };
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.504.0",
3
+ "version": "3.504.1",
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",