@jjrawlins/cdk-iam-policy-builder-helper 0.0.52 → 0.0.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/.jsii +3 -3
- package/cdk-iam-policy-builder-helper/jsii/jsii.go +2 -2
- package/cdk-iam-policy-builder-helper/version +1 -1
- package/node_modules/@aws-sdk/client-iam/dist-cjs/index.js +13439 -13574
- package/node_modules/@aws-sdk/client-iam/package.json +5 -5
- package/node_modules/@aws-sdk/client-sso/dist-cjs/index.js +478 -596
- package/node_modules/@aws-sdk/client-sso/package.json +4 -4
- package/node_modules/@aws-sdk/core/dist-cjs/index.js +1969 -6
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/account-id-endpoint/index.js +48 -88
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +35 -74
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +273 -365
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +1581 -1863
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +2 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +2 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeDeserializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeSerializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/AwsQueryProtocol.js +3 -3
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/QueryShapeSerializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/AwsRestXmlProtocol.js +2 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlShapeSerializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-types/submodules/account-id-endpoint/AccountIdEndpointModeConfigResolver.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/ConfigurableSerdeContext.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonCodec.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonShapeDeserializer.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonShapeSerializer.d.ts +2 -2
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/query/QuerySerializerSettings.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/xml/XmlCodec.d.ts +1 -1
- package/node_modules/@aws-sdk/core/package.json +1 -1
- package/node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js +38 -73
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js +194 -259
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +72 -132
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js +71 -107
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js +176 -249
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-CVy8iqsZ.js +14 -0
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js +16 -25
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js +170 -203
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/index.js +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +583 -858
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +795 -928
- package/node_modules/@aws-sdk/nested-clients/package.json +4 -4
- package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +147 -222
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js +50 -94
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +1 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +5 -3
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +32 -30
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +133 -202
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +126 -34
- package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +5 -3
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +4 -4
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +3 -3
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js +19 -17
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js +4 -4
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/determineTimestampFormat.js +5 -6
- package/node_modules/@smithy/core/dist-es/submodules/schema/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js +82 -176
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/translateTraits.js +22 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/schema-serde-lib/schema-date-utils.js +110 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/value/NumericValue.js +4 -26
- package/node_modules/@smithy/core/dist-types/submodules/schema/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +5 -24
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/sentinels.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/translateTraits.d.ts +7 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/schema-serde-lib/schema-date-utils.d.ts +47 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +5 -24
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/sentinels.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/translateTraits.d.ts +7 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/schema-serde-lib/schema-date-utils.d.ts +47 -0
- package/node_modules/@smithy/core/package.json +3 -3
- package/node_modules/@smithy/fetch-http-handler/package.json +2 -2
- package/node_modules/@smithy/middleware-endpoint/package.json +2 -2
- package/node_modules/@smithy/middleware-retry/package.json +2 -2
- package/node_modules/@smithy/smithy-client/package.json +4 -4
- package/node_modules/@smithy/util-base64/dist-cjs/constants.browser.js +9 -32
- package/node_modules/@smithy/util-base64/dist-es/constants.browser.js +9 -28
- package/node_modules/@smithy/util-base64/dist-types/constants.browser.d.ts +5 -6
- package/node_modules/@smithy/util-base64/dist-types/ts3.4/constants.browser.d.ts +5 -6
- package/node_modules/@smithy/util-base64/package.json +1 -1
- package/node_modules/@smithy/util-body-length-node/dist-cjs/index.js +8 -6
- package/node_modules/@smithy/util-body-length-node/dist-es/calculateBodyLength.js +8 -6
- package/node_modules/@smithy/util-body-length-node/package.json +1 -1
- package/node_modules/@smithy/util-defaults-mode-browser/dist-cjs/resolveDefaultsModeConfig.js +11 -9
- package/node_modules/@smithy/util-defaults-mode-browser/dist-es/resolveDefaultsModeConfig.js +11 -8
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -3
- package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
- package/node_modules/@smithy/util-stream/dist-cjs/index.js +3 -5
- package/node_modules/@smithy/util-stream/dist-es/blob/Uint8ArrayBlobAdapter.js +3 -5
- package/node_modules/@smithy/util-stream/dist-types/blob/Uint8ArrayBlobAdapter.d.ts +1 -0
- package/node_modules/@smithy/util-stream/dist-types/ts3.4/blob/Uint8ArrayBlobAdapter.d.ts +1 -0
- package/node_modules/@smithy/util-stream/package.json +3 -3
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/nested-clients",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.906.0",
|
|
4
4
|
"description": "Nested clients for AWS SDK packages.",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@aws-crypto/sha256-browser": "5.2.0",
|
|
31
31
|
"@aws-crypto/sha256-js": "5.2.0",
|
|
32
|
-
"@aws-sdk/core": "3.
|
|
32
|
+
"@aws-sdk/core": "3.906.0",
|
|
33
33
|
"@aws-sdk/middleware-host-header": "3.901.0",
|
|
34
34
|
"@aws-sdk/middleware-logger": "3.901.0",
|
|
35
35
|
"@aws-sdk/middleware-recursion-detection": "3.901.0",
|
|
36
|
-
"@aws-sdk/middleware-user-agent": "3.
|
|
36
|
+
"@aws-sdk/middleware-user-agent": "3.906.0",
|
|
37
37
|
"@aws-sdk/region-config-resolver": "3.901.0",
|
|
38
38
|
"@aws-sdk/types": "3.901.0",
|
|
39
39
|
"@aws-sdk/util-endpoints": "3.901.0",
|
|
40
40
|
"@aws-sdk/util-user-agent-browser": "3.901.0",
|
|
41
|
-
"@aws-sdk/util-user-agent-node": "3.
|
|
41
|
+
"@aws-sdk/util-user-agent-node": "3.906.0",
|
|
42
42
|
"@smithy/config-resolver": "^4.3.0",
|
|
43
43
|
"@smithy/core": "^3.14.0",
|
|
44
44
|
"@smithy/fetch-http-handler": "^5.3.0",
|
|
@@ -1,237 +1,162 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var client = require('@aws-sdk/core/client');
|
|
4
|
+
var httpAuthSchemes = require('@aws-sdk/core/httpAuthSchemes');
|
|
5
|
+
var propertyProvider = require('@smithy/property-provider');
|
|
6
|
+
var sharedIniFileLoader = require('@smithy/shared-ini-file-loader');
|
|
7
|
+
var fs = require('fs');
|
|
8
|
+
|
|
9
|
+
const fromEnvSigningName = ({ logger, signingName } = {}) => async () => {
|
|
10
|
+
logger?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
|
|
11
|
+
if (!signingName) {
|
|
12
|
+
throw new propertyProvider.TokenProviderError("Please pass 'signingName' to compute environment variable key", { logger });
|
|
13
|
+
}
|
|
14
|
+
const bearerTokenKey = httpAuthSchemes.getBearerTokenEnvKey(signingName);
|
|
15
|
+
if (!(bearerTokenKey in process.env)) {
|
|
16
|
+
throw new propertyProvider.TokenProviderError(`Token not present in '${bearerTokenKey}' environment variable`, { logger });
|
|
17
|
+
}
|
|
18
|
+
const token = { token: process.env[bearerTokenKey] };
|
|
19
|
+
client.setTokenFeature(token, "BEARER_SERVICE_ENV_VARS", "3");
|
|
20
|
+
return token;
|
|
20
21
|
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
-
|
|
31
|
-
// src/index.ts
|
|
32
|
-
var index_exports = {};
|
|
33
|
-
__export(index_exports, {
|
|
34
|
-
fromEnvSigningName: () => fromEnvSigningName,
|
|
35
|
-
fromSso: () => fromSso,
|
|
36
|
-
fromStatic: () => fromStatic,
|
|
37
|
-
nodeProvider: () => nodeProvider
|
|
38
|
-
});
|
|
39
|
-
module.exports = __toCommonJS(index_exports);
|
|
40
|
-
|
|
41
|
-
// src/fromEnvSigningName.ts
|
|
42
|
-
var import_client = require("@aws-sdk/core/client");
|
|
43
|
-
var import_httpAuthSchemes = require("@aws-sdk/core/httpAuthSchemes");
|
|
44
|
-
var import_property_provider = require("@smithy/property-provider");
|
|
45
|
-
var fromEnvSigningName = /* @__PURE__ */ __name(({ logger, signingName } = {}) => async () => {
|
|
46
|
-
logger?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
|
|
47
|
-
if (!signingName) {
|
|
48
|
-
throw new import_property_provider.TokenProviderError("Please pass 'signingName' to compute environment variable key", { logger });
|
|
49
|
-
}
|
|
50
|
-
const bearerTokenKey = (0, import_httpAuthSchemes.getBearerTokenEnvKey)(signingName);
|
|
51
|
-
if (!(bearerTokenKey in process.env)) {
|
|
52
|
-
throw new import_property_provider.TokenProviderError(`Token not present in '${bearerTokenKey}' environment variable`, { logger });
|
|
53
|
-
}
|
|
54
|
-
const token = { token: process.env[bearerTokenKey] };
|
|
55
|
-
(0, import_client.setTokenFeature)(token, "BEARER_SERVICE_ENV_VARS", "3");
|
|
56
|
-
return token;
|
|
57
|
-
}, "fromEnvSigningName");
|
|
58
|
-
|
|
59
|
-
// src/fromSso.ts
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
// src/constants.ts
|
|
64
|
-
var EXPIRE_WINDOW_MS = 5 * 60 * 1e3;
|
|
65
|
-
var REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;
|
|
66
22
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const { SSOOIDCClient } = await Promise.resolve().then(() => __toESM(require("@aws-sdk/nested-clients/sso-oidc")));
|
|
70
|
-
const ssoOidcClient = new SSOOIDCClient(
|
|
71
|
-
Object.assign({}, init.clientConfig ?? {}, {
|
|
72
|
-
region: ssoRegion ?? init.clientConfig?.region,
|
|
73
|
-
logger: init.clientConfig?.logger ?? init.parentClientConfig?.logger
|
|
74
|
-
})
|
|
75
|
-
);
|
|
76
|
-
return ssoOidcClient;
|
|
77
|
-
}, "getSsoOidcClient");
|
|
23
|
+
const EXPIRE_WINDOW_MS = 5 * 60 * 1000;
|
|
24
|
+
const REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;
|
|
78
25
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
refreshToken: ssoToken.refreshToken,
|
|
88
|
-
grantType: "refresh_token"
|
|
89
|
-
})
|
|
90
|
-
);
|
|
91
|
-
}, "getNewSsoOidcToken");
|
|
92
|
-
|
|
93
|
-
// src/validateTokenExpiry.ts
|
|
26
|
+
const getSsoOidcClient = async (ssoRegion, init = {}) => {
|
|
27
|
+
const { SSOOIDCClient } = await import('@aws-sdk/nested-clients/sso-oidc');
|
|
28
|
+
const ssoOidcClient = new SSOOIDCClient(Object.assign({}, init.clientConfig ?? {}, {
|
|
29
|
+
region: ssoRegion ?? init.clientConfig?.region,
|
|
30
|
+
logger: init.clientConfig?.logger ?? init.parentClientConfig?.logger,
|
|
31
|
+
}));
|
|
32
|
+
return ssoOidcClient;
|
|
33
|
+
};
|
|
94
34
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
35
|
+
const getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}) => {
|
|
36
|
+
const { CreateTokenCommand } = await import('@aws-sdk/nested-clients/sso-oidc');
|
|
37
|
+
const ssoOidcClient = await getSsoOidcClient(ssoRegion, init);
|
|
38
|
+
return ssoOidcClient.send(new CreateTokenCommand({
|
|
39
|
+
clientId: ssoToken.clientId,
|
|
40
|
+
clientSecret: ssoToken.clientSecret,
|
|
41
|
+
refreshToken: ssoToken.refreshToken,
|
|
42
|
+
grantType: "refresh_token",
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
100
45
|
|
|
101
|
-
|
|
46
|
+
const validateTokenExpiry = (token) => {
|
|
47
|
+
if (token.expiration && token.expiration.getTime() < Date.now()) {
|
|
48
|
+
throw new propertyProvider.TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
102
51
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
}, "validateTokenKey");
|
|
52
|
+
const validateTokenKey = (key, value, forRefresh = false) => {
|
|
53
|
+
if (typeof value === "undefined") {
|
|
54
|
+
throw new propertyProvider.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
111
57
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
119
|
-
return writeFile(tokenFilepath, tokenString);
|
|
120
|
-
}, "writeSSOTokenToFile");
|
|
58
|
+
const { writeFile } = fs.promises;
|
|
59
|
+
const writeSSOTokenToFile = (id, ssoToken) => {
|
|
60
|
+
const tokenFilepath = sharedIniFileLoader.getSSOTokenFilepath(id);
|
|
61
|
+
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
62
|
+
return writeFile(tokenFilepath, tokenString);
|
|
63
|
+
};
|
|
121
64
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
65
|
+
const lastRefreshAttemptTime = new Date(0);
|
|
66
|
+
const fromSso = (_init = {}) => async ({ callerClientConfig } = {}) => {
|
|
67
|
+
const init = {
|
|
68
|
+
..._init,
|
|
69
|
+
parentClientConfig: {
|
|
70
|
+
...callerClientConfig,
|
|
71
|
+
..._init.parentClientConfig,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
init.logger?.debug("@aws-sdk/token-providers - fromSso");
|
|
75
|
+
const profiles = await sharedIniFileLoader.parseKnownFiles(init);
|
|
76
|
+
const profileName = sharedIniFileLoader.getProfileName({
|
|
77
|
+
profile: init.profile ?? callerClientConfig?.profile,
|
|
78
|
+
});
|
|
79
|
+
const profile = profiles[profileName];
|
|
80
|
+
if (!profile) {
|
|
81
|
+
throw new propertyProvider.TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);
|
|
82
|
+
}
|
|
83
|
+
else if (!profile["sso_session"]) {
|
|
84
|
+
throw new propertyProvider.TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
|
|
130
85
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
});
|
|
137
|
-
const profile = profiles[profileName];
|
|
138
|
-
if (!profile) {
|
|
139
|
-
throw new import_property_provider.TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);
|
|
140
|
-
} else if (!profile["sso_session"]) {
|
|
141
|
-
throw new import_property_provider.TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
|
|
142
|
-
}
|
|
143
|
-
const ssoSessionName = profile["sso_session"];
|
|
144
|
-
const ssoSessions = await (0, import_shared_ini_file_loader.loadSsoSessionData)(init);
|
|
145
|
-
const ssoSession = ssoSessions[ssoSessionName];
|
|
146
|
-
if (!ssoSession) {
|
|
147
|
-
throw new import_property_provider.TokenProviderError(
|
|
148
|
-
`Sso session '${ssoSessionName}' could not be found in shared credentials file.`,
|
|
149
|
-
false
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) {
|
|
153
|
-
if (!ssoSession[ssoSessionRequiredKey]) {
|
|
154
|
-
throw new import_property_provider.TokenProviderError(
|
|
155
|
-
`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`,
|
|
156
|
-
false
|
|
157
|
-
);
|
|
86
|
+
const ssoSessionName = profile["sso_session"];
|
|
87
|
+
const ssoSessions = await sharedIniFileLoader.loadSsoSessionData(init);
|
|
88
|
+
const ssoSession = ssoSessions[ssoSessionName];
|
|
89
|
+
if (!ssoSession) {
|
|
90
|
+
throw new propertyProvider.TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);
|
|
158
91
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`,
|
|
168
|
-
false
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
validateTokenKey("accessToken", ssoToken.accessToken);
|
|
172
|
-
validateTokenKey("expiresAt", ssoToken.expiresAt);
|
|
173
|
-
const { accessToken, expiresAt } = ssoToken;
|
|
174
|
-
const existingToken = { token: accessToken, expiration: new Date(expiresAt) };
|
|
175
|
-
if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
|
|
176
|
-
return existingToken;
|
|
177
|
-
}
|
|
178
|
-
if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1e3) {
|
|
179
|
-
validateTokenExpiry(existingToken);
|
|
180
|
-
return existingToken;
|
|
181
|
-
}
|
|
182
|
-
validateTokenKey("clientId", ssoToken.clientId, true);
|
|
183
|
-
validateTokenKey("clientSecret", ssoToken.clientSecret, true);
|
|
184
|
-
validateTokenKey("refreshToken", ssoToken.refreshToken, true);
|
|
185
|
-
try {
|
|
186
|
-
lastRefreshAttemptTime.setTime(Date.now());
|
|
187
|
-
const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init);
|
|
188
|
-
validateTokenKey("accessToken", newSsoOidcToken.accessToken);
|
|
189
|
-
validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
|
|
190
|
-
const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1e3);
|
|
92
|
+
for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) {
|
|
93
|
+
if (!ssoSession[ssoSessionRequiredKey]) {
|
|
94
|
+
throw new propertyProvider.TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
ssoSession["sso_start_url"];
|
|
98
|
+
const ssoRegion = ssoSession["sso_region"];
|
|
99
|
+
let ssoToken;
|
|
191
100
|
try {
|
|
192
|
-
|
|
193
|
-
...ssoToken,
|
|
194
|
-
accessToken: newSsoOidcToken.accessToken,
|
|
195
|
-
expiresAt: newTokenExpiration.toISOString(),
|
|
196
|
-
refreshToken: newSsoOidcToken.refreshToken
|
|
197
|
-
});
|
|
198
|
-
} catch (error) {
|
|
101
|
+
ssoToken = await sharedIniFileLoader.getSSOTokenFromFile(ssoSessionName);
|
|
199
102
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
103
|
+
catch (e) {
|
|
104
|
+
throw new propertyProvider.TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
|
|
105
|
+
}
|
|
106
|
+
validateTokenKey("accessToken", ssoToken.accessToken);
|
|
107
|
+
validateTokenKey("expiresAt", ssoToken.expiresAt);
|
|
108
|
+
const { accessToken, expiresAt } = ssoToken;
|
|
109
|
+
const existingToken = { token: accessToken, expiration: new Date(expiresAt) };
|
|
110
|
+
if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
|
|
111
|
+
return existingToken;
|
|
112
|
+
}
|
|
113
|
+
if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1000) {
|
|
114
|
+
validateTokenExpiry(existingToken);
|
|
115
|
+
return existingToken;
|
|
116
|
+
}
|
|
117
|
+
validateTokenKey("clientId", ssoToken.clientId, true);
|
|
118
|
+
validateTokenKey("clientSecret", ssoToken.clientSecret, true);
|
|
119
|
+
validateTokenKey("refreshToken", ssoToken.refreshToken, true);
|
|
120
|
+
try {
|
|
121
|
+
lastRefreshAttemptTime.setTime(Date.now());
|
|
122
|
+
const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init);
|
|
123
|
+
validateTokenKey("accessToken", newSsoOidcToken.accessToken);
|
|
124
|
+
validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
|
|
125
|
+
const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
|
|
126
|
+
try {
|
|
127
|
+
await writeSSOTokenToFile(ssoSessionName, {
|
|
128
|
+
...ssoToken,
|
|
129
|
+
accessToken: newSsoOidcToken.accessToken,
|
|
130
|
+
expiresAt: newTokenExpiration.toISOString(),
|
|
131
|
+
refreshToken: newSsoOidcToken.refreshToken,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
token: newSsoOidcToken.accessToken,
|
|
138
|
+
expiration: newTokenExpiration,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
validateTokenExpiry(existingToken);
|
|
143
|
+
return existingToken;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
221
146
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
147
|
+
const fromStatic = ({ token, logger }) => async () => {
|
|
148
|
+
logger?.debug("@aws-sdk/token-providers - fromStatic");
|
|
149
|
+
if (!token || !token.token) {
|
|
150
|
+
throw new propertyProvider.TokenProviderError(`Please pass a valid token to fromStatic`, false);
|
|
151
|
+
}
|
|
152
|
+
return token;
|
|
153
|
+
};
|
|
230
154
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
fromStatic,
|
|
235
|
-
nodeProvider
|
|
236
|
-
});
|
|
155
|
+
const nodeProvider = (init = {}) => propertyProvider.memoize(propertyProvider.chain(fromSso(init), async () => {
|
|
156
|
+
throw new propertyProvider.TokenProviderError("Could not load token from any providers", false);
|
|
157
|
+
}), (token) => token.expiration !== undefined && token.expiration.getTime() - Date.now() < 300000, (token) => token.expiration !== undefined);
|
|
237
158
|
|
|
159
|
+
exports.fromEnvSigningName = fromEnvSigningName;
|
|
160
|
+
exports.fromSso = fromSso;
|
|
161
|
+
exports.fromStatic = fromStatic;
|
|
162
|
+
exports.nodeProvider = nodeProvider;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/token-providers",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.906.0",
|
|
4
4
|
"description": "A collection of token providers",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"license": "Apache-2.0",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@aws-sdk/core": "3.
|
|
33
|
-
"@aws-sdk/nested-clients": "3.
|
|
32
|
+
"@aws-sdk/core": "3.906.0",
|
|
33
|
+
"@aws-sdk/nested-clients": "3.906.0",
|
|
34
34
|
"@aws-sdk/types": "3.901.0",
|
|
35
35
|
"@smithy/property-provider": "^4.2.0",
|
|
36
36
|
"@smithy/shared-ini-file-loader": "^4.3.0",
|
|
@@ -1,102 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/index.ts
|
|
22
|
-
var index_exports = {};
|
|
23
|
-
__export(index_exports, {
|
|
24
|
-
NODE_APP_ID_CONFIG_OPTIONS: () => NODE_APP_ID_CONFIG_OPTIONS,
|
|
25
|
-
UA_APP_ID_ENV_NAME: () => UA_APP_ID_ENV_NAME,
|
|
26
|
-
UA_APP_ID_INI_NAME: () => UA_APP_ID_INI_NAME,
|
|
27
|
-
createDefaultUserAgentProvider: () => createDefaultUserAgentProvider,
|
|
28
|
-
crtAvailability: () => crtAvailability,
|
|
29
|
-
defaultUserAgent: () => defaultUserAgent
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(index_exports);
|
|
1
|
+
'use strict';
|
|
32
2
|
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
var
|
|
3
|
+
var os = require('os');
|
|
4
|
+
var process = require('process');
|
|
5
|
+
var middlewareUserAgent = require('@aws-sdk/middleware-user-agent');
|
|
36
6
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
isCrtAvailable: false
|
|
7
|
+
const crtAvailability = {
|
|
8
|
+
isCrtAvailable: false,
|
|
40
9
|
};
|
|
41
10
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return ["md/crt-avail"];
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
}, "isCrtAvailable");
|
|
49
|
-
|
|
50
|
-
// src/defaultUserAgent.ts
|
|
51
|
-
var createDefaultUserAgentProvider = /* @__PURE__ */ __name(({ serviceId, clientVersion }) => {
|
|
52
|
-
return async (config) => {
|
|
53
|
-
const sections = [
|
|
54
|
-
// sdk-metadata
|
|
55
|
-
["aws-sdk-js", clientVersion],
|
|
56
|
-
// ua-metadata
|
|
57
|
-
["ua", "2.1"],
|
|
58
|
-
// os-metadata
|
|
59
|
-
[`os/${(0, import_os.platform)()}`, (0, import_os.release)()],
|
|
60
|
-
// language-metadata
|
|
61
|
-
// ECMAScript edition doesn't matter in JS, so no version needed.
|
|
62
|
-
["lang/js"],
|
|
63
|
-
["md/nodejs", `${import_process.versions.node}`]
|
|
64
|
-
];
|
|
65
|
-
const crtAvailable = isCrtAvailable();
|
|
66
|
-
if (crtAvailable) {
|
|
67
|
-
sections.push(crtAvailable);
|
|
68
|
-
}
|
|
69
|
-
if (serviceId) {
|
|
70
|
-
sections.push([`api/${serviceId}`, clientVersion]);
|
|
11
|
+
const isCrtAvailable = () => {
|
|
12
|
+
if (crtAvailability.isCrtAvailable) {
|
|
13
|
+
return ["md/crt-avail"];
|
|
71
14
|
}
|
|
72
|
-
|
|
73
|
-
sections.push([`exec-env/${import_process.env.AWS_EXECUTION_ENV}`]);
|
|
74
|
-
}
|
|
75
|
-
const appId = await config?.userAgentAppId?.();
|
|
76
|
-
const resolvedUserAgent = appId ? [...sections, [`app/${appId}`]] : [...sections];
|
|
77
|
-
return resolvedUserAgent;
|
|
78
|
-
};
|
|
79
|
-
}, "createDefaultUserAgentProvider");
|
|
80
|
-
var defaultUserAgent = createDefaultUserAgentProvider;
|
|
81
|
-
|
|
82
|
-
// src/nodeAppIdConfigOptions.ts
|
|
83
|
-
var import_middleware_user_agent = require("@aws-sdk/middleware-user-agent");
|
|
84
|
-
var UA_APP_ID_ENV_NAME = "AWS_SDK_UA_APP_ID";
|
|
85
|
-
var UA_APP_ID_INI_NAME = "sdk_ua_app_id";
|
|
86
|
-
var UA_APP_ID_INI_NAME_DEPRECATED = "sdk-ua-app-id";
|
|
87
|
-
var NODE_APP_ID_CONFIG_OPTIONS = {
|
|
88
|
-
environmentVariableSelector: /* @__PURE__ */ __name((env2) => env2[UA_APP_ID_ENV_NAME], "environmentVariableSelector"),
|
|
89
|
-
configFileSelector: /* @__PURE__ */ __name((profile) => profile[UA_APP_ID_INI_NAME] ?? profile[UA_APP_ID_INI_NAME_DEPRECATED], "configFileSelector"),
|
|
90
|
-
default: import_middleware_user_agent.DEFAULT_UA_APP_ID
|
|
15
|
+
return null;
|
|
91
16
|
};
|
|
92
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
93
17
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
18
|
+
const createDefaultUserAgentProvider = ({ serviceId, clientVersion }) => {
|
|
19
|
+
return async (config) => {
|
|
20
|
+
const sections = [
|
|
21
|
+
["aws-sdk-js", clientVersion],
|
|
22
|
+
["ua", "2.1"],
|
|
23
|
+
[`os/${os.platform()}`, os.release()],
|
|
24
|
+
["lang/js"],
|
|
25
|
+
["md/nodejs", `${process.versions.node}`],
|
|
26
|
+
];
|
|
27
|
+
const crtAvailable = isCrtAvailable();
|
|
28
|
+
if (crtAvailable) {
|
|
29
|
+
sections.push(crtAvailable);
|
|
30
|
+
}
|
|
31
|
+
if (serviceId) {
|
|
32
|
+
sections.push([`api/${serviceId}`, clientVersion]);
|
|
33
|
+
}
|
|
34
|
+
if (process.env.AWS_EXECUTION_ENV) {
|
|
35
|
+
sections.push([`exec-env/${process.env.AWS_EXECUTION_ENV}`]);
|
|
36
|
+
}
|
|
37
|
+
const appId = await config?.userAgentAppId?.();
|
|
38
|
+
const resolvedUserAgent = appId ? [...sections, [`app/${appId}`]] : [...sections];
|
|
39
|
+
return resolvedUserAgent;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
const defaultUserAgent = createDefaultUserAgentProvider;
|
|
43
|
+
|
|
44
|
+
const UA_APP_ID_ENV_NAME = "AWS_SDK_UA_APP_ID";
|
|
45
|
+
const UA_APP_ID_INI_NAME = "sdk_ua_app_id";
|
|
46
|
+
const UA_APP_ID_INI_NAME_DEPRECATED = "sdk-ua-app-id";
|
|
47
|
+
const NODE_APP_ID_CONFIG_OPTIONS = {
|
|
48
|
+
environmentVariableSelector: (env) => env[UA_APP_ID_ENV_NAME],
|
|
49
|
+
configFileSelector: (profile) => profile[UA_APP_ID_INI_NAME] ?? profile[UA_APP_ID_INI_NAME_DEPRECATED],
|
|
50
|
+
default: middlewareUserAgent.DEFAULT_UA_APP_ID,
|
|
51
|
+
};
|
|
102
52
|
|
|
53
|
+
exports.NODE_APP_ID_CONFIG_OPTIONS = NODE_APP_ID_CONFIG_OPTIONS;
|
|
54
|
+
exports.UA_APP_ID_ENV_NAME = UA_APP_ID_ENV_NAME;
|
|
55
|
+
exports.UA_APP_ID_INI_NAME = UA_APP_ID_INI_NAME;
|
|
56
|
+
exports.createDefaultUserAgentProvider = createDefaultUserAgentProvider;
|
|
57
|
+
exports.crtAvailability = crtAvailability;
|
|
58
|
+
exports.defaultUserAgent = defaultUserAgent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-user-agent-node",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.906.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "node ../../scripts/compilation/inline util-user-agent-node",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@aws-sdk/middleware-user-agent": "3.
|
|
25
|
+
"@aws-sdk/middleware-user-agent": "3.906.0",
|
|
26
26
|
"@aws-sdk/types": "3.901.0",
|
|
27
27
|
"@smithy/node-config-provider": "^4.3.0",
|
|
28
28
|
"@smithy/types": "^4.6.0",
|
|
@@ -887,7 +887,7 @@ class CborShapeDeserializer {
|
|
|
887
887
|
readValue(_schema, value) {
|
|
888
888
|
const ns = schema.NormalizedSchema.of(_schema);
|
|
889
889
|
if (ns.isTimestampSchema() && typeof value === "number") {
|
|
890
|
-
return serde.
|
|
890
|
+
return serde._parseEpochTimestamp(value);
|
|
891
891
|
}
|
|
892
892
|
if (ns.isBlobSchema()) {
|
|
893
893
|
if (typeof value === "string") {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var schema = require('@smithy/core/schema');
|
|
4
3
|
var utilUtf8 = require('@smithy/util-utf8');
|
|
5
4
|
|
|
6
5
|
class EventStreamSerde {
|
|
@@ -131,12 +130,15 @@ class EventStreamSerde {
|
|
|
131
130
|
let eventType = unionMember;
|
|
132
131
|
let explicitPayloadMember = null;
|
|
133
132
|
let explicitPayloadContentType;
|
|
134
|
-
const isKnownSchema =
|
|
133
|
+
const isKnownSchema = (() => {
|
|
134
|
+
const struct = unionSchema.getSchema();
|
|
135
|
+
return struct.memberNames.includes(unionMember);
|
|
136
|
+
})();
|
|
135
137
|
const additionalHeaders = {};
|
|
136
138
|
if (!isKnownSchema) {
|
|
137
139
|
const [type, value] = event[unionMember];
|
|
138
140
|
eventType = type;
|
|
139
|
-
serializer.write(
|
|
141
|
+
serializer.write(15, value);
|
|
140
142
|
}
|
|
141
143
|
else {
|
|
142
144
|
const eventSchema = unionSchema.getMemberSchema(unionMember);
|