@aws-sdk/credential-provider-web-identity 3.972.52 → 3.972.53
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 +10 -14
- package/dist-cjs/fromWebToken.js +2 -6
- package/dist-cjs/index.js +3 -27
- package/package.json +7 -7
|
@@ -1,33 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const config_1 = require("@smithy/core/config");
|
|
6
|
-
const node_fs_1 = require("node:fs");
|
|
7
|
-
const fromWebToken_1 = require("./fromWebToken");
|
|
1
|
+
const { setCredentialFeature } = require("@aws-sdk/core/client");
|
|
2
|
+
const { CredentialsProviderError, externalDataInterceptor } = require("@smithy/core/config");
|
|
3
|
+
const { readFileSync } = require("node:fs");
|
|
4
|
+
const { fromWebToken } = require("./fromWebToken");
|
|
8
5
|
const ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE";
|
|
9
6
|
const ENV_ROLE_ARN = "AWS_ROLE_ARN";
|
|
10
7
|
const ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME";
|
|
11
|
-
|
|
8
|
+
exports.fromTokenFile = (init = {}) => async (awsIdentityProperties) => {
|
|
12
9
|
init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");
|
|
13
10
|
const webIdentityTokenFile = init?.webIdentityTokenFile ?? process.env[ENV_TOKEN_FILE];
|
|
14
11
|
const roleArn = init?.roleArn ?? process.env[ENV_ROLE_ARN];
|
|
15
12
|
const roleSessionName = init?.roleSessionName ?? process.env[ENV_ROLE_SESSION_NAME];
|
|
16
13
|
if (!webIdentityTokenFile || !roleArn) {
|
|
17
|
-
throw new
|
|
14
|
+
throw new CredentialsProviderError("Web identity configuration not specified", {
|
|
18
15
|
logger: init.logger,
|
|
19
16
|
});
|
|
20
17
|
}
|
|
21
|
-
const credentials = await
|
|
18
|
+
const credentials = await fromWebToken({
|
|
22
19
|
...init,
|
|
23
|
-
webIdentityToken:
|
|
24
|
-
|
|
20
|
+
webIdentityToken: externalDataInterceptor?.getTokenRecord?.()[webIdentityTokenFile] ??
|
|
21
|
+
readFileSync(webIdentityTokenFile, { encoding: "ascii" }),
|
|
25
22
|
roleArn,
|
|
26
23
|
roleSessionName,
|
|
27
24
|
})(awsIdentityProperties);
|
|
28
25
|
if (webIdentityTokenFile === process.env[ENV_TOKEN_FILE]) {
|
|
29
|
-
|
|
26
|
+
setCredentialFeature(credentials, "CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN", "h");
|
|
30
27
|
}
|
|
31
28
|
return credentials;
|
|
32
29
|
};
|
|
33
|
-
exports.fromTokenFile = fromTokenFile;
|
package/dist-cjs/fromWebToken.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fromWebToken = void 0;
|
|
4
|
-
const fromWebToken = (init) => async (awsIdentityProperties) => {
|
|
1
|
+
exports.fromWebToken = (init) => async (awsIdentityProperties) => {
|
|
5
2
|
init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");
|
|
6
3
|
const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds } = init;
|
|
7
4
|
let { roleAssumerWithWebIdentity } = init;
|
|
8
5
|
if (!roleAssumerWithWebIdentity) {
|
|
9
|
-
const { getDefaultRoleAssumerWithWebIdentity } =
|
|
6
|
+
const { getDefaultRoleAssumerWithWebIdentity } = require("@aws-sdk/nested-clients/sts");
|
|
10
7
|
roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({
|
|
11
8
|
...init.clientConfig,
|
|
12
9
|
credentialProviderLogger: init.logger,
|
|
@@ -26,4 +23,3 @@ const fromWebToken = (init) => async (awsIdentityProperties) => {
|
|
|
26
23
|
DurationSeconds: durationSeconds,
|
|
27
24
|
});
|
|
28
25
|
};
|
|
29
|
-
exports.fromWebToken = fromWebToken;
|
package/dist-cjs/index.js
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var fromWebToken = require('./fromWebToken');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.prototype.hasOwnProperty.call(fromTokenFile, '__proto__') &&
|
|
9
|
-
!Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
|
|
10
|
-
Object.defineProperty(exports, '__proto__', {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
value: fromTokenFile['__proto__']
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
Object.keys(fromTokenFile).forEach(function (k) {
|
|
16
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = fromTokenFile[k];
|
|
17
|
-
});
|
|
18
|
-
Object.prototype.hasOwnProperty.call(fromWebToken, '__proto__') &&
|
|
19
|
-
!Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
|
|
20
|
-
Object.defineProperty(exports, '__proto__', {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
value: fromWebToken['__proto__']
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
Object.keys(fromWebToken).forEach(function (k) {
|
|
26
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = fromWebToken[k];
|
|
27
|
-
});
|
|
1
|
+
var __exportStar = (m, e) => { Object.assign(e, m); };
|
|
2
|
+
__exportStar(require("./fromTokenFile"), exports);
|
|
3
|
+
__exportStar(require("./fromWebToken"), exports);
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-web-identity",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.53",
|
|
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",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
9
9
|
"build:cjs": "node ../../scripts/compilation/inline",
|
|
10
|
-
"build:es": "tsc -p tsconfig.es.json",
|
|
10
|
+
"build:es": "premove dist-es && tsc -p tsconfig.es.json",
|
|
11
11
|
"build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
|
|
12
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
12
|
+
"build:types": "premove dist-types && tsc -p tsconfig.types.json",
|
|
13
13
|
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
14
|
-
"clean": "premove dist-cjs dist-es dist-types
|
|
14
|
+
"clean": "premove dist-cjs dist-es dist-types",
|
|
15
15
|
"test": "yarn g:vitest run",
|
|
16
16
|
"test:watch": "yarn g:vitest watch"
|
|
17
17
|
},
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
},
|
|
35
35
|
"license": "Apache-2.0",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@aws-sdk/core": "^3.974.
|
|
38
|
-
"@aws-sdk/nested-clients": "^3.997.
|
|
39
|
-
"@aws-sdk/types": "^3.973.
|
|
37
|
+
"@aws-sdk/core": "^3.974.21",
|
|
38
|
+
"@aws-sdk/nested-clients": "^3.997.21",
|
|
39
|
+
"@aws-sdk/types": "^3.973.13",
|
|
40
40
|
"@smithy/core": "^3.24.6",
|
|
41
41
|
"@smithy/types": "^4.14.3",
|
|
42
42
|
"tslib": "^2.6.2"
|