@cdklabs/cdk-ecs-codedeploy 0.0.460 → 0.0.462
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/lib/api-canary/index.js +1 -1
- package/lib/ecs-appspec/index.js +1 -1
- package/lib/ecs-deployment/index.js +1 -1
- package/lib/ecs-patterns/application-load-balanced-codedeployed-fargate-service.js +1 -1
- package/node_modules/@aws-sdk/client-codedeploy/dist-cjs/index.js +49 -11
- package/node_modules/@aws-sdk/client-codedeploy/dist-es/models/enums.js +6 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-es/models/errors.js +13 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-es/schemas/schemas_0.js +27 -11
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/CodeDeployClient.d.ts +2 -1
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/BatchGetDeploymentGroupsCommand.d.ts +5 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/BatchGetDeploymentsCommand.d.ts +5 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/CreateDeploymentCommand.d.ts +11 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/CreateDeploymentGroupCommand.d.ts +11 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/GetDeploymentCommand.d.ts +5 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/GetDeploymentGroupCommand.d.ts +5 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/UpdateDeploymentGroupCommand.d.ts +11 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/models/enums.d.ts +14 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/models/errors.d.ts +16 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/models/models_0.d.ts +64 -1
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/schemas/schemas_0.d.ts +2 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/models/enums.d.ts +8 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/models/errors.d.ts +8 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/models/models_0.d.ts +9 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/schemas/schemas_0.d.ts +2 -0
- package/node_modules/@aws-sdk/client-codedeploy/package.json +5 -5
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +12 -3
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +94 -1589
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js +12 -3
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +1 -7
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +1 -3
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +1 -3
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/index.d.ts +2 -8
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -2
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -2
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -3
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsRestJsonProtocol.d.ts +2 -3
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/index.d.ts +10 -10
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -3
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsRestJsonProtocol.d.ts +2 -3
- package/node_modules/@aws-sdk/core/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-env/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-http/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +11 -11
- package/node_modules/@aws-sdk/credential-provider-login/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-node/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-process/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +5 -5
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/CognitoIdentityClient.d.ts +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/SigninClient.d.ts +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/SSOClient.d.ts +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/SSOOIDCClient.d.ts +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/STSClient.d.ts +2 -1
- package/node_modules/@aws-sdk/nested-clients/package.json +5 -5
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +2 -2
- package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +37 -19
- package/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +37 -19
- package/node_modules/@aws-sdk/token-providers/package.json +5 -5
- package/node_modules/@aws-sdk/types/dist-types/feature-ids.d.ts +3 -0
- package/node_modules/@aws-sdk/types/dist-types/ts3.4/feature-ids.d.ts +3 -0
- package/node_modules/@aws-sdk/types/package.json +1 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +13 -37
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +15 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +10 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +10 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +1711 -4
- package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +12 -37
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/command.js +16 -2
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/HeaderMarshaller.js +10 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/AbstractRpcV2Protocol.js +35 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/ConfigurableSerdeContext.js +6 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +4 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/UnionSerde.js +26 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/common.js +3 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +9 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/json/SmithyRpcV2JsonProtocol.js +79 -0
- package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js +8 -1
- package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js +8 -1
- package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js +13 -2
- package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +16 -6
- package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/parseJsonBody.js +16 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/writeKey.js +3 -0
- package/node_modules/@smithy/core/dist-types/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +5 -14
- package/node_modules/@smithy/core/dist-types/submodules/protocols/AbstractRpcV2Protocol.d.ts +45 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/ConfigurableSerdeContext.d.ts +8 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/RpcProtocol.d.ts +12 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/UnionSerde.d.ts +24 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/common.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/index.d.ts +10 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/json/JsonSettings.d.ts +13 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +19 -0
- package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/parseJsonBody.d.ts +16 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/writeKey.d.ts +4 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +5 -14
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/AbstractRpcV2Protocol.d.ts +45 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/ConfigurableSerdeContext.d.ts +8 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/RpcProtocol.d.ts +12 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/UnionSerde.d.ts +24 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/common.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/index.d.ts +10 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/JsonSettings.d.ts +13 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +19 -0
- package/node_modules/{@aws-sdk → @smithy}/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonCodec.d.ts +15 -11
- package/node_modules/{@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json → @smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1}/JsonSettings.d.ts +7 -4
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +14 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +29 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +51 -0
- package/node_modules/{@aws-sdk → @smithy}/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +13 -9
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +30 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +60 -0
- package/node_modules/{@aws-sdk → @smithy}/core/dist-types/ts3.4/submodules/protocols/json/detectBufferParsing.d.ts +1 -1
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +21 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +15 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +11 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +38 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/writeKey.d.ts +4 -0
- package/node_modules/@smithy/core/package.json +2 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +48 -6
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +9 -1
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +20 -2
- package/node_modules/@smithy/node-http-handler/dist-es/resolve-default-socket-timeout.js +4 -0
- package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +16 -3
- package/node_modules/@smithy/node-http-handler/dist-types/resolve-default-socket-timeout.d.ts +4 -0
- package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +6 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/resolve-default-socket-timeout.d.ts +4 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +6 -1
- package/node_modules/@smithy/node-http-handler/package.json +3 -3
- package/package.json +2 -2
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +0 -13
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +0 -18
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -27
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +0 -15
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +0 -39
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +0 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +0 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +0 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +0 -14
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/JsonSettings.js +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonCodec.js +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonSettings.js +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.js +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/detectBufferParsing.js +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/jsonReplacer.js +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/jsonReviver.js +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/needsReviver.js +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v1/JsonCodec.d.ts +0 -0
- /package/node_modules/{@aws-sdk/core/dist-types/submodules/protocols/json → @smithy/core/dist-types/submodules/protocols/json/codec-v1}/JsonSettings.d.ts +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/detectBufferParsing.d.ts +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/jsonReplacer.d.ts +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/jsonReviver.d.ts +0 -0
- /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/needsReviver.d.ts +0 -0
|
@@ -62,6 +62,7 @@ const writeSSOTokenToFile = (id, ssoToken) => {
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
const lastRefreshAttemptTimes = new Map();
|
|
65
|
+
const inFlightRefreshes = new Map();
|
|
65
66
|
const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
66
67
|
init.logger?.debug("@aws-sdk/token-providers - fromSso");
|
|
67
68
|
const profiles = await parseKnownFiles(init);
|
|
@@ -76,6 +77,10 @@ const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
|
76
77
|
throw new TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
|
|
77
78
|
}
|
|
78
79
|
const ssoSessionName = profile["sso_session"];
|
|
80
|
+
const inFlightRefresh = inFlightRefreshes.get(ssoSessionName);
|
|
81
|
+
if (inFlightRefresh) {
|
|
82
|
+
return await inFlightRefresh;
|
|
83
|
+
}
|
|
79
84
|
const ssoSessions = await loadSsoSessionData(init);
|
|
80
85
|
const ssoSession = ssoSessions[ssoSessionName];
|
|
81
86
|
if (!ssoSession) {
|
|
@@ -105,6 +110,10 @@ const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
|
105
110
|
if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
|
|
106
111
|
return existingToken;
|
|
107
112
|
}
|
|
113
|
+
const inFlightRefreshAfterReadingToken = inFlightRefreshes.get(ssoSessionName);
|
|
114
|
+
if (inFlightRefreshAfterReadingToken) {
|
|
115
|
+
return await inFlightRefreshAfterReadingToken;
|
|
116
|
+
}
|
|
108
117
|
const lastRefreshAttemptTime = lastRefreshAttemptTimes.get(ssoSessionName) ?? 0;
|
|
109
118
|
if (Date.now() - lastRefreshAttemptTime < 30 * 1000) {
|
|
110
119
|
validateTokenExpiry(existingToken);
|
|
@@ -113,30 +122,39 @@ const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
|
113
122
|
validateTokenKey("clientId", ssoToken.clientId, true);
|
|
114
123
|
validateTokenKey("clientSecret", ssoToken.clientSecret, true);
|
|
115
124
|
validateTokenKey("refreshToken", ssoToken.refreshToken, true);
|
|
116
|
-
|
|
117
|
-
lastRefreshAttemptTimes.set(ssoSessionName, Date.now());
|
|
118
|
-
const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
|
|
119
|
-
validateTokenKey("accessToken", newSsoOidcToken.accessToken);
|
|
120
|
-
validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
|
|
121
|
-
const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
|
|
125
|
+
const refresh = (async () => {
|
|
122
126
|
try {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
lastRefreshAttemptTimes.set(ssoSessionName, Date.now());
|
|
128
|
+
const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
|
|
129
|
+
validateTokenKey("accessToken", newSsoOidcToken.accessToken);
|
|
130
|
+
validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
|
|
131
|
+
const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
|
|
132
|
+
try {
|
|
133
|
+
await writeSSOTokenToFile(ssoSessionName, {
|
|
134
|
+
...ssoToken,
|
|
135
|
+
accessToken: newSsoOidcToken.accessToken,
|
|
136
|
+
expiresAt: newTokenExpiration.toISOString(),
|
|
137
|
+
refreshToken: newSsoOidcToken.refreshToken,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
token: newSsoOidcToken.accessToken,
|
|
144
|
+
expiration: newTokenExpiration,
|
|
145
|
+
};
|
|
129
146
|
}
|
|
130
147
|
catch (error) {
|
|
148
|
+
validateTokenExpiry(existingToken);
|
|
149
|
+
return existingToken;
|
|
131
150
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
151
|
+
})();
|
|
152
|
+
inFlightRefreshes.set(ssoSessionName, refresh);
|
|
153
|
+
try {
|
|
154
|
+
return await refresh;
|
|
136
155
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return existingToken;
|
|
156
|
+
finally {
|
|
157
|
+
inFlightRefreshes.delete(ssoSessionName);
|
|
140
158
|
}
|
|
141
159
|
};
|
|
142
160
|
|
|
@@ -5,6 +5,7 @@ import { validateTokenExpiry } from "./validateTokenExpiry";
|
|
|
5
5
|
import { validateTokenKey } from "./validateTokenKey";
|
|
6
6
|
import { writeSSOTokenToFile } from "./writeSSOTokenToFile";
|
|
7
7
|
const lastRefreshAttemptTimes = new Map();
|
|
8
|
+
const inFlightRefreshes = new Map();
|
|
8
9
|
export const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
9
10
|
init.logger?.debug("@aws-sdk/token-providers - fromSso");
|
|
10
11
|
const profiles = await parseKnownFiles(init);
|
|
@@ -19,6 +20,10 @@ export const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
|
19
20
|
throw new TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
|
|
20
21
|
}
|
|
21
22
|
const ssoSessionName = profile["sso_session"];
|
|
23
|
+
const inFlightRefresh = inFlightRefreshes.get(ssoSessionName);
|
|
24
|
+
if (inFlightRefresh) {
|
|
25
|
+
return await inFlightRefresh;
|
|
26
|
+
}
|
|
22
27
|
const ssoSessions = await loadSsoSessionData(init);
|
|
23
28
|
const ssoSession = ssoSessions[ssoSessionName];
|
|
24
29
|
if (!ssoSession) {
|
|
@@ -48,6 +53,10 @@ export const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
|
48
53
|
if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
|
|
49
54
|
return existingToken;
|
|
50
55
|
}
|
|
56
|
+
const inFlightRefreshAfterReadingToken = inFlightRefreshes.get(ssoSessionName);
|
|
57
|
+
if (inFlightRefreshAfterReadingToken) {
|
|
58
|
+
return await inFlightRefreshAfterReadingToken;
|
|
59
|
+
}
|
|
51
60
|
const lastRefreshAttemptTime = lastRefreshAttemptTimes.get(ssoSessionName) ?? 0;
|
|
52
61
|
if (Date.now() - lastRefreshAttemptTime < 30 * 1000) {
|
|
53
62
|
validateTokenExpiry(existingToken);
|
|
@@ -56,29 +65,38 @@ export const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
|
56
65
|
validateTokenKey("clientId", ssoToken.clientId, true);
|
|
57
66
|
validateTokenKey("clientSecret", ssoToken.clientSecret, true);
|
|
58
67
|
validateTokenKey("refreshToken", ssoToken.refreshToken, true);
|
|
59
|
-
|
|
60
|
-
lastRefreshAttemptTimes.set(ssoSessionName, Date.now());
|
|
61
|
-
const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
|
|
62
|
-
validateTokenKey("accessToken", newSsoOidcToken.accessToken);
|
|
63
|
-
validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
|
|
64
|
-
const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
|
|
68
|
+
const refresh = (async () => {
|
|
65
69
|
try {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
lastRefreshAttemptTimes.set(ssoSessionName, Date.now());
|
|
71
|
+
const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
|
|
72
|
+
validateTokenKey("accessToken", newSsoOidcToken.accessToken);
|
|
73
|
+
validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
|
|
74
|
+
const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
|
|
75
|
+
try {
|
|
76
|
+
await writeSSOTokenToFile(ssoSessionName, {
|
|
77
|
+
...ssoToken,
|
|
78
|
+
accessToken: newSsoOidcToken.accessToken,
|
|
79
|
+
expiresAt: newTokenExpiration.toISOString(),
|
|
80
|
+
refreshToken: newSsoOidcToken.refreshToken,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
token: newSsoOidcToken.accessToken,
|
|
87
|
+
expiration: newTokenExpiration,
|
|
88
|
+
};
|
|
72
89
|
}
|
|
73
90
|
catch (error) {
|
|
91
|
+
validateTokenExpiry(existingToken);
|
|
92
|
+
return existingToken;
|
|
74
93
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
94
|
+
})();
|
|
95
|
+
inFlightRefreshes.set(ssoSessionName, refresh);
|
|
96
|
+
try {
|
|
97
|
+
return await refresh;
|
|
79
98
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return existingToken;
|
|
99
|
+
finally {
|
|
100
|
+
inFlightRefreshes.delete(ssoSessionName);
|
|
83
101
|
}
|
|
84
102
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/token-providers",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1155.0",
|
|
4
4
|
"description": "A collection of token providers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@aws-sdk/core": "^3.978.
|
|
52
|
-
"@aws-sdk/nested-clients": "^3.997.
|
|
53
|
-
"@aws-sdk/types": "^3.
|
|
54
|
-
"@smithy/core": "^3.
|
|
51
|
+
"@aws-sdk/core": "^3.978.5",
|
|
52
|
+
"@aws-sdk/nested-clients": "^3.997.50",
|
|
53
|
+
"@aws-sdk/types": "^3.975.0",
|
|
54
|
+
"@smithy/core": "^3.36.1",
|
|
55
55
|
"@smithy/types": "^4.19.0",
|
|
56
56
|
"tslib": "^2.6.2"
|
|
57
57
|
},
|
|
@@ -8,6 +8,9 @@ export type AwsSdkFeatures = Partial<{
|
|
|
8
8
|
RETRY_MODE_LEGACY: "D";
|
|
9
9
|
RETRY_MODE_STANDARD: "E";
|
|
10
10
|
RETRY_MODE_ADAPTIVE: "F";
|
|
11
|
+
S3_TRANSFER: "G";
|
|
12
|
+
S3_TRANSFER_UPLOAD_DIRECTORY: "9";
|
|
13
|
+
S3_TRANSFER_DOWNLOAD_DIRECTORY: "+";
|
|
11
14
|
S3_EXPRESS_BUCKET: "J";
|
|
12
15
|
S3_ACCESS_GRANTS: "K";
|
|
13
16
|
GZIP_REQUEST_COMPRESSION: "L";
|
|
@@ -5,6 +5,9 @@ export type AwsSdkFeatures = Partial<{
|
|
|
5
5
|
RETRY_MODE_LEGACY: "D";
|
|
6
6
|
RETRY_MODE_STANDARD: "E";
|
|
7
7
|
RETRY_MODE_ADAPTIVE: "F";
|
|
8
|
+
S3_TRANSFER: "G";
|
|
9
|
+
S3_TRANSFER_UPLOAD_DIRECTORY: "9";
|
|
10
|
+
S3_TRANSFER_DOWNLOAD_DIRECTORY: "+";
|
|
8
11
|
S3_EXPRESS_BUCKET: "J";
|
|
9
12
|
S3_ACCESS_GRANTS: "K";
|
|
10
13
|
GZIP_REQUEST_COMPRESSION: "L";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { nv, NumericValue, calculateBodyLength, generateIdempotencyToken, fromBase64, _parseEpochTimestamp } = require("@smithy/core/serde");
|
|
2
|
-
const { hasOwn
|
|
3
|
-
const { HttpRequest, collectBody, SerdeContext,
|
|
4
|
-
const { NormalizedSchema,
|
|
2
|
+
const { hasOwn } = require("@smithy/core/transport");
|
|
3
|
+
const { HttpRequest, collectBody, SerdeContext, AbstractRpcV2Protocol } = require("@smithy/core/protocols");
|
|
4
|
+
const { NormalizedSchema, TypeRegistry } = require("@smithy/core/schema");
|
|
5
5
|
|
|
6
6
|
const majorUint64 = 0;
|
|
7
7
|
const majorNegativeInt64 = 1;
|
|
@@ -2216,51 +2216,27 @@ class CborCodec extends SerdeContext {
|
|
|
2216
2216
|
}
|
|
2217
2217
|
}
|
|
2218
2218
|
|
|
2219
|
-
class SmithyRpcV2CborProtocol extends
|
|
2219
|
+
class SmithyRpcV2CborProtocol extends AbstractRpcV2Protocol {
|
|
2220
2220
|
codec = new CborCodec();
|
|
2221
2221
|
serializer = this.codec.createSerializer();
|
|
2222
2222
|
deserializer = this.codec.createDeserializer();
|
|
2223
|
-
constructor({ defaultNamespace, errorTypeRegistries, }) {
|
|
2224
|
-
super({ defaultNamespace, errorTypeRegistries });
|
|
2225
|
-
}
|
|
2226
2223
|
getShapeId() {
|
|
2227
2224
|
return "smithy.protocols#rpcv2Cbor";
|
|
2228
2225
|
}
|
|
2229
2226
|
getPayloadCodec() {
|
|
2230
2227
|
return this.codec;
|
|
2231
2228
|
}
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
if (deref(operationSchema.input) === "unit") {
|
|
2240
|
-
delete request.body;
|
|
2241
|
-
delete request.headers["content-type"];
|
|
2242
|
-
}
|
|
2243
|
-
else {
|
|
2244
|
-
if (!request.body) {
|
|
2245
|
-
this.serializer.write(15, {});
|
|
2246
|
-
request.body = this.serializer.flush();
|
|
2247
|
-
}
|
|
2248
|
-
if (request.body instanceof Uint8Array) {
|
|
2249
|
-
request.headers["content-length"] = String(request.body.byteLength);
|
|
2250
|
-
}
|
|
2251
|
-
}
|
|
2252
|
-
const { service, operation } = getSmithyContext(context);
|
|
2253
|
-
const path = `/service/${service}/operation/${operation}`;
|
|
2254
|
-
if (request.path.endsWith("/")) {
|
|
2255
|
-
request.path += path.slice(1);
|
|
2229
|
+
getSmithyProtocolHeaderValue() {
|
|
2230
|
+
return "rpc-v2-cbor";
|
|
2231
|
+
}
|
|
2232
|
+
applyEmptyBody(request) {
|
|
2233
|
+
if (!request.body) {
|
|
2234
|
+
this.serializer.write(15, {});
|
|
2235
|
+
request.body = this.serializer.flush();
|
|
2256
2236
|
}
|
|
2257
|
-
|
|
2258
|
-
request.
|
|
2237
|
+
if (request.body instanceof Uint8Array) {
|
|
2238
|
+
request.headers["content-length"] = String(request.body.byteLength);
|
|
2259
2239
|
}
|
|
2260
|
-
return request;
|
|
2261
|
-
}
|
|
2262
|
-
async deserializeResponse(operationSchema, context, response) {
|
|
2263
|
-
return super.deserializeResponse(operationSchema, context, response);
|
|
2264
2240
|
}
|
|
2265
2241
|
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
2266
2242
|
const errorIdentifier = loadSmithyRpcV2CborErrorCode(response, dataObject) ?? "Unknown";
|
|
@@ -578,6 +578,7 @@ function schemaLogFilter(schema, data) {
|
|
|
578
578
|
return data;
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
+
const operationEventStreamMarker = Symbol.for("@smithy/op-event-stream");
|
|
581
582
|
class Command {
|
|
582
583
|
middlewareStack = constructStack();
|
|
583
584
|
schema;
|
|
@@ -611,9 +612,21 @@ class Command {
|
|
|
611
612
|
requestOptions = { ...requestOptions };
|
|
612
613
|
delete requestOptions.metricsRecorder;
|
|
613
614
|
}
|
|
614
|
-
|
|
615
|
+
let isEventStream;
|
|
616
|
+
const schema = this.schema;
|
|
617
|
+
const marker = schema?.[operationEventStreamMarker];
|
|
618
|
+
if (marker !== undefined) {
|
|
619
|
+
isEventStream = marker;
|
|
620
|
+
}
|
|
621
|
+
else if (schema) {
|
|
622
|
+
if (Array.isArray(schema) && schema[0] === 9) {
|
|
623
|
+
const [, , , , input$, output$] = schema;
|
|
624
|
+
isEventStream = schema[operationEventStreamMarker] = Boolean(NormalizedSchema.of(input$).getEventStreamMember() || NormalizedSchema.of(output$).getEventStreamMember());
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
if (isEventStream) {
|
|
615
628
|
requestOptions = {
|
|
616
|
-
isEventStream
|
|
629
|
+
isEventStream,
|
|
617
630
|
...requestOptions,
|
|
618
631
|
};
|
|
619
632
|
}
|
|
@@ -60,6 +60,9 @@ class HeaderMarshaller {
|
|
|
60
60
|
if (!hasOwn(headers, headerName))
|
|
61
61
|
continue;
|
|
62
62
|
const bytes = this.fromUtf8(headerName);
|
|
63
|
+
if (bytes.byteLength > 255) {
|
|
64
|
+
throw new Error(`@smithy/core/event-streams - header name exceeds 255 bytes: ${bytes.byteLength}`);
|
|
65
|
+
}
|
|
63
66
|
chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
|
|
64
67
|
}
|
|
65
68
|
const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
|
|
@@ -92,6 +95,9 @@ class HeaderMarshaller {
|
|
|
92
95
|
longBytes.set(header.value.bytes, 1);
|
|
93
96
|
return longBytes;
|
|
94
97
|
case "binary":
|
|
98
|
+
if (header.value.byteLength > MAX_HEADER_VALUE_BYTES) {
|
|
99
|
+
throw new Error(`@smithy/core/event-streams - header value (binary) exceeds ${MAX_HEADER_VALUE_BYTES} bytes: ${header.value.byteLength}`);
|
|
100
|
+
}
|
|
95
101
|
const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
|
|
96
102
|
binView.setUint8(0, 6);
|
|
97
103
|
binView.setUint16(1, header.value.byteLength, false);
|
|
@@ -100,6 +106,9 @@ class HeaderMarshaller {
|
|
|
100
106
|
return binBytes;
|
|
101
107
|
case "string":
|
|
102
108
|
const utf8Bytes = this.fromUtf8(header.value);
|
|
109
|
+
if (utf8Bytes.byteLength > MAX_HEADER_VALUE_BYTES) {
|
|
110
|
+
throw new Error(`@smithy/core/event-streams - header value (string) exceeds ${MAX_HEADER_VALUE_BYTES} bytes: ${utf8Bytes.byteLength}`);
|
|
111
|
+
}
|
|
103
112
|
const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
|
|
104
113
|
strView.setUint8(0, 7);
|
|
105
114
|
strView.setUint16(1, utf8Bytes.byteLength, false);
|
|
@@ -231,6 +240,7 @@ const STRING_TAG = "string";
|
|
|
231
240
|
const TIMESTAMP_TAG = "timestamp";
|
|
232
241
|
const UUID_TAG = "uuid";
|
|
233
242
|
const UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
|
243
|
+
const MAX_HEADER_VALUE_BYTES = 32767;
|
|
234
244
|
|
|
235
245
|
const PRELUDE_MEMBER_LENGTH = 4;
|
|
236
246
|
const PRELUDE_LENGTH = PRELUDE_MEMBER_LENGTH * 2;
|
|
@@ -61,6 +61,9 @@ class HeaderMarshaller {
|
|
|
61
61
|
if (!hasOwn(headers, headerName))
|
|
62
62
|
continue;
|
|
63
63
|
const bytes = this.fromUtf8(headerName);
|
|
64
|
+
if (bytes.byteLength > 255) {
|
|
65
|
+
throw new Error(`@smithy/core/event-streams - header name exceeds 255 bytes: ${bytes.byteLength}`);
|
|
66
|
+
}
|
|
64
67
|
chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
|
|
65
68
|
}
|
|
66
69
|
const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
|
|
@@ -93,6 +96,9 @@ class HeaderMarshaller {
|
|
|
93
96
|
longBytes.set(header.value.bytes, 1);
|
|
94
97
|
return longBytes;
|
|
95
98
|
case "binary":
|
|
99
|
+
if (header.value.byteLength > MAX_HEADER_VALUE_BYTES) {
|
|
100
|
+
throw new Error(`@smithy/core/event-streams - header value (binary) exceeds ${MAX_HEADER_VALUE_BYTES} bytes: ${header.value.byteLength}`);
|
|
101
|
+
}
|
|
96
102
|
const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
|
|
97
103
|
binView.setUint8(0, 6);
|
|
98
104
|
binView.setUint16(1, header.value.byteLength, false);
|
|
@@ -101,6 +107,9 @@ class HeaderMarshaller {
|
|
|
101
107
|
return binBytes;
|
|
102
108
|
case "string":
|
|
103
109
|
const utf8Bytes = this.fromUtf8(header.value);
|
|
110
|
+
if (utf8Bytes.byteLength > MAX_HEADER_VALUE_BYTES) {
|
|
111
|
+
throw new Error(`@smithy/core/event-streams - header value (string) exceeds ${MAX_HEADER_VALUE_BYTES} bytes: ${utf8Bytes.byteLength}`);
|
|
112
|
+
}
|
|
104
113
|
const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
|
|
105
114
|
strView.setUint8(0, 7);
|
|
106
115
|
strView.setUint16(1, utf8Bytes.byteLength, false);
|
|
@@ -232,6 +241,7 @@ const STRING_TAG = "string";
|
|
|
232
241
|
const TIMESTAMP_TAG = "timestamp";
|
|
233
242
|
const UUID_TAG = "uuid";
|
|
234
243
|
const UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
|
244
|
+
const MAX_HEADER_VALUE_BYTES = 32767;
|
|
235
245
|
|
|
236
246
|
const PRELUDE_MEMBER_LENGTH = 4;
|
|
237
247
|
const PRELUDE_LENGTH = PRELUDE_MEMBER_LENGTH * 2;
|