@aws-sdk/credential-provider-web-identity 3.496.0 → 3.504.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/fromTokenFile.js +5 -4
- package/dist-cjs/fromWebToken.js +7 -5
- package/dist-cjs/loadSts.js +5 -0
- package/dist-es/fromTokenFile.js +1 -0
- package/dist-es/fromWebToken.js +6 -5
- package/dist-es/loadSts.js +2 -0
- package/dist-types/fromTokenFile.d.ts +4 -3
- package/dist-types/fromWebToken.d.ts +14 -4
- package/dist-types/loadSts.d.ts +3 -0
- package/dist-types/ts3.4/fromTokenFile.d.ts +7 -2
- package/dist-types/ts3.4/fromWebToken.d.ts +12 -6
- package/dist-types/ts3.4/loadSts.d.ts +3 -0
- package/package.json +3 -2
|
@@ -8,10 +8,11 @@ const ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE";
|
|
|
8
8
|
const ENV_ROLE_ARN = "AWS_ROLE_ARN";
|
|
9
9
|
const ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME";
|
|
10
10
|
const fromTokenFile = (init = {}) => async () => {
|
|
11
|
-
var _a, _b, _c;
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
11
|
+
var _a, _b, _c, _d;
|
|
12
|
+
(_a = init.logger) === null || _a === void 0 ? void 0 : _a.debug("@aws-sdk/credential-provider-web-identity", "fromTokenFile");
|
|
13
|
+
const webIdentityTokenFile = (_b = init === null || init === void 0 ? void 0 : init.webIdentityTokenFile) !== null && _b !== void 0 ? _b : process.env[ENV_TOKEN_FILE];
|
|
14
|
+
const roleArn = (_c = init === null || init === void 0 ? void 0 : init.roleArn) !== null && _c !== void 0 ? _c : process.env[ENV_ROLE_ARN];
|
|
15
|
+
const roleSessionName = (_d = init === null || init === void 0 ? void 0 : init.roleSessionName) !== null && _d !== void 0 ? _d : process.env[ENV_ROLE_SESSION_NAME];
|
|
15
16
|
if (!webIdentityTokenFile || !roleArn) {
|
|
16
17
|
throw new property_provider_1.CredentialsProviderError("Web identity configuration not specified");
|
|
17
18
|
}
|
package/dist-cjs/fromWebToken.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fromWebToken = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const fromWebToken = (init) => async () => {
|
|
5
|
+
var _a;
|
|
6
|
+
(_a = init.logger) === null || _a === void 0 ? void 0 : _a.debug("@aws-sdk/credential-provider-web-identity", "fromWebToken");
|
|
7
|
+
const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds } = init;
|
|
8
|
+
let { roleAssumerWithWebIdentity } = init;
|
|
7
9
|
if (!roleAssumerWithWebIdentity) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
const { getDefaultRoleAssumerWithWebIdentity } = await Promise.resolve().then(() => __importStar(require("./loadSts")));
|
|
11
|
+
roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins);
|
|
10
12
|
}
|
|
11
13
|
return roleAssumerWithWebIdentity({
|
|
12
14
|
RoleArn: roleArn,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultRoleAssumerWithWebIdentity = void 0;
|
|
4
|
+
const client_sts_1 = require("@aws-sdk/client-sts");
|
|
5
|
+
Object.defineProperty(exports, "getDefaultRoleAssumerWithWebIdentity", { enumerable: true, get: function () { return client_sts_1.getDefaultRoleAssumerWithWebIdentity; } });
|
package/dist-es/fromTokenFile.js
CHANGED
|
@@ -5,6 +5,7 @@ const ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE";
|
|
|
5
5
|
const ENV_ROLE_ARN = "AWS_ROLE_ARN";
|
|
6
6
|
const ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME";
|
|
7
7
|
export const fromTokenFile = (init = {}) => async () => {
|
|
8
|
+
init.logger?.debug("@aws-sdk/credential-provider-web-identity", "fromTokenFile");
|
|
8
9
|
const webIdentityTokenFile = init?.webIdentityTokenFile ?? process.env[ENV_TOKEN_FILE];
|
|
9
10
|
const roleArn = init?.roleArn ?? process.env[ENV_ROLE_ARN];
|
|
10
11
|
const roleSessionName = init?.roleSessionName ?? process.env[ENV_ROLE_SESSION_NAME];
|
package/dist-es/fromWebToken.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds
|
|
1
|
+
export const fromWebToken = (init) => async () => {
|
|
2
|
+
init.logger?.debug("@aws-sdk/credential-provider-web-identity", "fromWebToken");
|
|
3
|
+
const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds } = init;
|
|
4
|
+
let { roleAssumerWithWebIdentity } = init;
|
|
4
5
|
if (!roleAssumerWithWebIdentity) {
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
const { getDefaultRoleAssumerWithWebIdentity } = await import("./loadSts");
|
|
7
|
+
roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins);
|
|
7
8
|
}
|
|
8
9
|
return roleAssumerWithWebIdentity({
|
|
9
10
|
RoleArn: roleArn,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CredentialProviderOptions } from "@aws-sdk/types";
|
|
2
|
+
import type { AwsCredentialIdentityProvider } from "@smithy/types";
|
|
2
3
|
import { FromWebTokenInit } from "./fromWebToken";
|
|
3
4
|
/**
|
|
4
|
-
* @
|
|
5
|
+
* @public
|
|
5
6
|
*/
|
|
6
|
-
export interface FromTokenFileInit extends Partial<Omit<FromWebTokenInit, "webIdentityToken"
|
|
7
|
+
export interface FromTokenFileInit extends Partial<Omit<FromWebTokenInit, "webIdentityToken">>, CredentialProviderOptions {
|
|
7
8
|
/**
|
|
8
9
|
* File location of where the `OIDC` token is stored.
|
|
9
10
|
*/
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CredentialProviderOptions } from "@aws-sdk/types";
|
|
2
|
+
import type { AwsCredentialIdentity, AwsCredentialIdentityProvider, Pluggable } from "@smithy/types";
|
|
3
|
+
import type { STSClientConfig } from "./loadSts";
|
|
2
4
|
/**
|
|
3
|
-
* @
|
|
5
|
+
* @public
|
|
4
6
|
*/
|
|
5
7
|
export interface AssumeRoleWithWebIdentityParams {
|
|
6
8
|
/**
|
|
@@ -113,9 +115,9 @@ type LowerCaseKey<T> = {
|
|
|
113
115
|
[K in keyof T as `${Uncapitalize<string & K>}`]: T[K];
|
|
114
116
|
};
|
|
115
117
|
/**
|
|
116
|
-
* @
|
|
118
|
+
* @public
|
|
117
119
|
*/
|
|
118
|
-
export interface FromWebTokenInit extends Omit<LowerCaseKey<AssumeRoleWithWebIdentityParams>, "roleSessionName"
|
|
120
|
+
export interface FromWebTokenInit extends Omit<LowerCaseKey<AssumeRoleWithWebIdentityParams>, "roleSessionName">, CredentialProviderOptions {
|
|
119
121
|
/**
|
|
120
122
|
* The IAM session name used to distinguish sessions.
|
|
121
123
|
*/
|
|
@@ -127,6 +129,14 @@ export interface FromWebTokenInit extends Omit<LowerCaseKey<AssumeRoleWithWebIde
|
|
|
127
129
|
* @param params input parameter of sts:AssumeRoleWithWebIdentity API.
|
|
128
130
|
*/
|
|
129
131
|
roleAssumerWithWebIdentity?: (params: AssumeRoleWithWebIdentityParams) => Promise<AwsCredentialIdentity>;
|
|
132
|
+
/**
|
|
133
|
+
* @internal
|
|
134
|
+
*/
|
|
135
|
+
clientConfig?: STSClientConfig;
|
|
136
|
+
/**
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
clientPlugins?: Pluggable<any, any>[];
|
|
130
140
|
}
|
|
131
141
|
/**
|
|
132
142
|
* @internal
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { CredentialProviderOptions } from "@aws-sdk/types";
|
|
1
2
|
import { AwsCredentialIdentityProvider } from "@smithy/types";
|
|
2
3
|
import { FromWebTokenInit } from "./fromWebToken";
|
|
3
4
|
export interface FromTokenFileInit
|
|
4
5
|
extends Partial<
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
Pick<
|
|
7
|
+
FromWebTokenInit,
|
|
8
|
+
Exclude<keyof FromWebTokenInit, "webIdentityToken">
|
|
9
|
+
>
|
|
10
|
+
>,
|
|
11
|
+
CredentialProviderOptions {
|
|
7
12
|
webIdentityTokenFile?: string;
|
|
8
13
|
}
|
|
9
14
|
export declare const fromTokenFile: (
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { CredentialProviderOptions } from "@aws-sdk/types";
|
|
1
2
|
import {
|
|
2
3
|
AwsCredentialIdentity,
|
|
3
4
|
AwsCredentialIdentityProvider,
|
|
5
|
+
Pluggable,
|
|
4
6
|
} from "@smithy/types";
|
|
7
|
+
import { STSClientConfig } from "./loadSts";
|
|
5
8
|
export interface AssumeRoleWithWebIdentityParams {
|
|
6
9
|
RoleArn: string;
|
|
7
10
|
RoleSessionName: string;
|
|
@@ -18,16 +21,19 @@ type LowerCaseKey<T> = {
|
|
|
18
21
|
};
|
|
19
22
|
export interface FromWebTokenInit
|
|
20
23
|
extends Pick<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
LowerCaseKey<AssumeRoleWithWebIdentityParams>,
|
|
25
|
+
Exclude<
|
|
26
|
+
keyof LowerCaseKey<AssumeRoleWithWebIdentityParams>,
|
|
27
|
+
"roleSessionName"
|
|
28
|
+
>
|
|
29
|
+
>,
|
|
30
|
+
CredentialProviderOptions {
|
|
27
31
|
roleSessionName?: string;
|
|
28
32
|
roleAssumerWithWebIdentity?: (
|
|
29
33
|
params: AssumeRoleWithWebIdentityParams
|
|
30
34
|
) => Promise<AwsCredentialIdentity>;
|
|
35
|
+
clientConfig?: STSClientConfig;
|
|
36
|
+
clientPlugins?: Pluggable<any, any>[];
|
|
31
37
|
}
|
|
32
38
|
export declare const fromWebToken: (
|
|
33
39
|
init: FromWebTokenInit
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-web-identity",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.504.0",
|
|
4
4
|
"description": "AWS credential provider that calls STS assumeRole for temporary AWS credentials",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"license": "Apache-2.0",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@aws-sdk/
|
|
35
|
+
"@aws-sdk/client-sts": "3.504.0",
|
|
36
|
+
"@aws-sdk/types": "3.502.0",
|
|
36
37
|
"@smithy/property-provider": "^2.1.1",
|
|
37
38
|
"@smithy/types": "^2.9.1",
|
|
38
39
|
"tslib": "^2.5.0"
|