@aws-sdk/credential-provider-web-identity 3.183.0 → 3.186.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/CHANGELOG.md +8 -0
- package/dist-es/fromTokenFile.js +17 -15
- package/dist-es/fromWebToken.js +17 -15
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-sdk/credential-provider-web-identity
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @aws-sdk/credential-provider-web-identity
|
package/dist-es/fromTokenFile.js
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
|
+
import { __assign, __awaiter, __generator } from "tslib";
|
|
1
2
|
import { CredentialsProviderError } from "@aws-sdk/property-provider";
|
|
2
3
|
import { readFileSync } from "fs";
|
|
3
4
|
import { fromWebToken } from "./fromWebToken";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
|
|
5
|
+
var ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE";
|
|
6
|
+
var ENV_ROLE_ARN = "AWS_ROLE_ARN";
|
|
7
|
+
var ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME";
|
|
8
|
+
export var fromTokenFile = function (init) {
|
|
9
|
+
if (init === void 0) { init = {}; }
|
|
10
|
+
return function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
11
|
+
return __generator(this, function (_a) {
|
|
12
|
+
return [2, resolveTokenFile(init)];
|
|
13
|
+
});
|
|
14
|
+
}); };
|
|
9
15
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
var resolveTokenFile = function (init) {
|
|
17
|
+
var _a, _b, _c;
|
|
18
|
+
var webIdentityTokenFile = (_a = init === null || init === void 0 ? void 0 : init.webIdentityTokenFile) !== null && _a !== void 0 ? _a : process.env[ENV_TOKEN_FILE];
|
|
19
|
+
var roleArn = (_b = init === null || init === void 0 ? void 0 : init.roleArn) !== null && _b !== void 0 ? _b : process.env[ENV_ROLE_ARN];
|
|
20
|
+
var roleSessionName = (_c = init === null || init === void 0 ? void 0 : init.roleSessionName) !== null && _c !== void 0 ? _c : process.env[ENV_ROLE_SESSION_NAME];
|
|
14
21
|
if (!webIdentityTokenFile || !roleArn) {
|
|
15
22
|
throw new CredentialsProviderError("Web identity configuration not specified");
|
|
16
23
|
}
|
|
17
|
-
return fromWebToken({
|
|
18
|
-
...init,
|
|
19
|
-
webIdentityToken: readFileSync(webIdentityTokenFile, { encoding: "ascii" }),
|
|
20
|
-
roleArn,
|
|
21
|
-
roleSessionName,
|
|
22
|
-
})();
|
|
24
|
+
return fromWebToken(__assign(__assign({}, init), { webIdentityToken: readFileSync(webIdentityTokenFile, { encoding: "ascii" }), roleArn: roleArn, roleSessionName: roleSessionName }))();
|
|
23
25
|
};
|
package/dist-es/fromWebToken.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { CredentialsProviderError } from "@aws-sdk/property-provider";
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
export var fromWebToken = function (init) {
|
|
3
|
+
return function () {
|
|
4
|
+
var roleArn = init.roleArn, roleSessionName = init.roleSessionName, webIdentityToken = init.webIdentityToken, providerId = init.providerId, policyArns = init.policyArns, policy = init.policy, durationSeconds = init.durationSeconds, roleAssumerWithWebIdentity = init.roleAssumerWithWebIdentity;
|
|
5
|
+
if (!roleAssumerWithWebIdentity) {
|
|
6
|
+
throw new CredentialsProviderError("Role Arn '".concat(roleArn, "' needs to be assumed with web identity,") +
|
|
7
|
+
" but no role assumption callback was provided.", false);
|
|
8
|
+
}
|
|
9
|
+
return roleAssumerWithWebIdentity({
|
|
10
|
+
RoleArn: roleArn,
|
|
11
|
+
RoleSessionName: roleSessionName !== null && roleSessionName !== void 0 ? roleSessionName : "aws-sdk-js-session-".concat(Date.now()),
|
|
12
|
+
WebIdentityToken: webIdentityToken,
|
|
13
|
+
ProviderId: providerId,
|
|
14
|
+
PolicyArns: policyArns,
|
|
15
|
+
Policy: policy,
|
|
16
|
+
DurationSeconds: durationSeconds,
|
|
17
|
+
});
|
|
18
|
+
};
|
|
17
19
|
};
|
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.186.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,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"license": "Apache-2.0",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@aws-sdk/property-provider": "3.
|
|
36
|
-
"@aws-sdk/types": "3.
|
|
35
|
+
"@aws-sdk/property-provider": "3.186.0",
|
|
36
|
+
"@aws-sdk/types": "3.186.0",
|
|
37
37
|
"tslib": "^2.3.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|