@cdk8s/awscdk-resolver 0.0.57 → 0.0.59

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.
Files changed (155) hide show
  1. package/.jsii +3 -3
  2. package/lib/resolve.js +1 -1
  3. package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/auth/httpAuthSchemeProvider.js +47 -0
  4. package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/index.js +267 -1714
  5. package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/runtimeConfig.shared.js +10 -0
  6. package/node_modules/@aws-sdk/client-cloudformation/dist-es/CloudFormationClient.js +17 -4
  7. package/node_modules/@aws-sdk/client-cloudformation/dist-es/auth/httpAuthExtensionConfiguration.js +38 -0
  8. package/node_modules/@aws-sdk/client-cloudformation/dist-es/auth/httpAuthSchemeProvider.js +41 -0
  9. package/node_modules/@aws-sdk/client-cloudformation/dist-es/protocols/Aws_query.js +180 -1685
  10. package/node_modules/@aws-sdk/client-cloudformation/dist-es/runtimeConfig.shared.js +10 -0
  11. package/node_modules/@aws-sdk/client-cloudformation/dist-es/runtimeExtensions.js +3 -0
  12. package/node_modules/@aws-sdk/client-cloudformation/dist-types/CloudFormationClient.d.ts +13 -11
  13. package/node_modules/@aws-sdk/client-cloudformation/dist-types/auth/httpAuthExtensionConfiguration.d.ts +29 -0
  14. package/node_modules/@aws-sdk/client-cloudformation/dist-types/auth/httpAuthSchemeProvider.d.ts +61 -0
  15. package/node_modules/@aws-sdk/client-cloudformation/dist-types/extensionConfiguration.d.ts +2 -1
  16. package/node_modules/@aws-sdk/client-cloudformation/dist-types/runtimeConfig.browser.d.ts +5 -3
  17. package/node_modules/@aws-sdk/client-cloudformation/dist-types/runtimeConfig.d.ts +4 -2
  18. package/node_modules/@aws-sdk/client-cloudformation/dist-types/runtimeConfig.native.d.ts +6 -4
  19. package/node_modules/@aws-sdk/client-cloudformation/dist-types/runtimeConfig.shared.d.ts +2 -0
  20. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/CloudFormationClient.d.ts +11 -9
  21. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/auth/httpAuthExtensionConfiguration.d.ts +32 -0
  22. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/auth/httpAuthSchemeProvider.d.ts +44 -0
  23. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/extensionConfiguration.d.ts +3 -1
  24. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/runtimeConfig.browser.d.ts +5 -5
  25. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/runtimeConfig.d.ts +4 -4
  26. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/runtimeConfig.native.d.ts +8 -8
  27. package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/runtimeConfig.shared.d.ts +2 -0
  28. package/node_modules/@aws-sdk/client-cloudformation/package.json +16 -16
  29. package/node_modules/@aws-sdk/client-sso/dist-cjs/auth/httpAuthSchemeProvider.js +68 -0
  30. package/node_modules/@aws-sdk/client-sso/dist-cjs/index.js +76 -96
  31. package/node_modules/@aws-sdk/client-sso/dist-cjs/runtimeConfig.shared.js +16 -0
  32. package/node_modules/@aws-sdk/client-sso/dist-es/SSOClient.js +19 -3
  33. package/node_modules/@aws-sdk/client-sso/dist-es/auth/httpAuthExtensionConfiguration.js +38 -0
  34. package/node_modules/@aws-sdk/client-sso/dist-es/auth/httpAuthSchemeProvider.js +62 -0
  35. package/node_modules/@aws-sdk/client-sso/dist-es/protocols/Aws_restJson1.js +8 -89
  36. package/node_modules/@aws-sdk/client-sso/dist-es/runtimeConfig.shared.js +16 -0
  37. package/node_modules/@aws-sdk/client-sso/dist-es/runtimeExtensions.js +3 -0
  38. package/node_modules/@aws-sdk/client-sso/dist-types/SSOClient.d.ts +9 -6
  39. package/node_modules/@aws-sdk/client-sso/dist-types/auth/httpAuthExtensionConfiguration.d.ts +29 -0
  40. package/node_modules/@aws-sdk/client-sso/dist-types/auth/httpAuthSchemeProvider.d.ts +61 -0
  41. package/node_modules/@aws-sdk/client-sso/dist-types/extensionConfiguration.d.ts +2 -1
  42. package/node_modules/@aws-sdk/client-sso/dist-types/runtimeConfig.browser.d.ts +16 -0
  43. package/node_modules/@aws-sdk/client-sso/dist-types/runtimeConfig.d.ts +16 -0
  44. package/node_modules/@aws-sdk/client-sso/dist-types/runtimeConfig.native.d.ts +17 -1
  45. package/node_modules/@aws-sdk/client-sso/dist-types/runtimeConfig.shared.d.ts +13 -0
  46. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/SSOClient.d.ts +9 -1
  47. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/auth/httpAuthExtensionConfiguration.d.ts +32 -0
  48. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/auth/httpAuthSchemeProvider.d.ts +43 -0
  49. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/extensionConfiguration.d.ts +3 -1
  50. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/runtimeConfig.browser.d.ts +46 -0
  51. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/runtimeConfig.d.ts +46 -0
  52. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/runtimeConfig.native.d.ts +47 -1
  53. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/runtimeConfig.shared.d.ts +30 -0
  54. package/node_modules/@aws-sdk/client-sso/package.json +14 -13
  55. package/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/auth/httpAuthSchemeProvider.js +64 -0
  56. package/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js +96 -144
  57. package/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/runtimeConfig.shared.js +16 -0
  58. package/node_modules/@aws-sdk/client-sso-oidc/dist-es/SSOOIDCClient.js +17 -3
  59. package/node_modules/@aws-sdk/client-sso-oidc/dist-es/auth/httpAuthExtensionConfiguration.js +38 -0
  60. package/node_modules/@aws-sdk/client-sso-oidc/dist-es/auth/httpAuthSchemeProvider.js +58 -0
  61. package/node_modules/@aws-sdk/client-sso-oidc/dist-es/commands/CreateTokenWithIAMCommand.js +0 -2
  62. package/node_modules/@aws-sdk/client-sso-oidc/dist-es/protocols/Aws_restJson1.js +29 -134
  63. package/node_modules/@aws-sdk/client-sso-oidc/dist-es/runtimeConfig.shared.js +16 -0
  64. package/node_modules/@aws-sdk/client-sso-oidc/dist-es/runtimeExtensions.js +3 -0
  65. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/SSOOIDCClient.d.ts +13 -11
  66. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/auth/httpAuthExtensionConfiguration.d.ts +29 -0
  67. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/auth/httpAuthSchemeProvider.d.ts +61 -0
  68. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/extensionConfiguration.d.ts +2 -1
  69. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/runtimeConfig.browser.d.ts +13 -3
  70. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/runtimeConfig.d.ts +12 -2
  71. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/runtimeConfig.native.d.ts +14 -4
  72. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/runtimeConfig.shared.d.ts +13 -0
  73. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/ts3.4/SSOOIDCClient.d.ts +11 -9
  74. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/ts3.4/auth/httpAuthExtensionConfiguration.d.ts +32 -0
  75. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/ts3.4/auth/httpAuthSchemeProvider.d.ts +44 -0
  76. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/ts3.4/extensionConfiguration.d.ts +3 -1
  77. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/ts3.4/runtimeConfig.browser.d.ts +30 -5
  78. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/ts3.4/runtimeConfig.d.ts +29 -4
  79. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/ts3.4/runtimeConfig.native.d.ts +33 -8
  80. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/ts3.4/runtimeConfig.shared.d.ts +30 -0
  81. package/node_modules/@aws-sdk/client-sso-oidc/package.json +16 -16
  82. package/node_modules/@aws-sdk/client-sts/dist-cjs/index.js +74 -196
  83. package/node_modules/@aws-sdk/client-sts/dist-es/defaultStsRoleAssumers.js +17 -15
  84. package/node_modules/@aws-sdk/client-sts/dist-es/protocols/Aws_query.js +30 -178
  85. package/node_modules/@aws-sdk/client-sts/dist-types/defaultRoleAssumers.d.ts +4 -4
  86. package/node_modules/@aws-sdk/client-sts/dist-types/defaultStsRoleAssumers.d.ts +11 -3
  87. package/node_modules/@aws-sdk/client-sts/dist-types/ts3.4/defaultRoleAssumers.d.ts +4 -7
  88. package/node_modules/@aws-sdk/client-sts/dist-types/ts3.4/defaultStsRoleAssumers.d.ts +11 -3
  89. package/node_modules/@aws-sdk/client-sts/package.json +14 -14
  90. package/node_modules/@aws-sdk/core/CHANGELOG.md +22 -0
  91. package/node_modules/@aws-sdk/core/dist-cjs/index.js +13 -7
  92. package/node_modules/@aws-sdk/core/dist-es/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.js +6 -2
  93. package/node_modules/@aws-sdk/core/package.json +2 -2
  94. package/node_modules/@aws-sdk/core/src/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.ts +10 -2
  95. package/node_modules/@aws-sdk/core/tsconfig.cjs.tsbuildinfo +1 -1
  96. package/node_modules/@aws-sdk/core/tsconfig.es.tsbuildinfo +1 -1
  97. package/node_modules/@aws-sdk/core/tsconfig.types.tsbuildinfo +1 -1
  98. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  99. package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
  100. package/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js +10 -2
  101. package/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveAssumeRoleCredentials.js +5 -1
  102. package/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveWebIdentityCredentials.js +1 -0
  103. package/node_modules/@aws-sdk/credential-provider-ini/package.json +7 -7
  104. package/node_modules/@aws-sdk/credential-provider-node/package.json +10 -9
  105. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  106. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  107. package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js +28 -1
  108. package/node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromWebToken.js +5 -1
  109. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  110. package/node_modules/@aws-sdk/middleware-host-header/package.json +2 -2
  111. package/node_modules/@aws-sdk/middleware-logger/package.json +2 -2
  112. package/node_modules/@aws-sdk/middleware-recursion-detection/package.json +2 -2
  113. package/node_modules/@aws-sdk/middleware-user-agent/package.json +3 -3
  114. package/node_modules/@aws-sdk/region-config-resolver/package.json +2 -2
  115. package/node_modules/@aws-sdk/token-providers/package.json +3 -3
  116. package/node_modules/@aws-sdk/types/dist-types/credentials.d.ts +16 -0
  117. package/node_modules/@aws-sdk/types/dist-types/ts3.4/credentials.d.ts +3 -0
  118. package/node_modules/@aws-sdk/types/package.json +1 -1
  119. package/node_modules/@aws-sdk/util-endpoints/package.json +2 -2
  120. package/node_modules/@aws-sdk/util-user-agent-browser/package.json +2 -2
  121. package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
  122. package/node_modules/@smithy/core/dist-cjs/index.js +26 -15
  123. package/node_modules/@smithy/core/dist-es/pagination/createPaginator.js +12 -1
  124. package/node_modules/@smithy/core/package.json +1 -1
  125. package/node_modules/@smithy/util-defaults-mode-node/dist-cjs/index.js +13 -3
  126. package/node_modules/@smithy/util-defaults-mode-node/dist-es/resolveDefaultsModeConfig.js +1 -1
  127. package/node_modules/@smithy/util-defaults-mode-node/package.json +1 -1
  128. package/package.json +5 -5
  129. package/node_modules/@aws-sdk/middleware-signing/LICENSE +0 -201
  130. package/node_modules/@aws-sdk/middleware-signing/README.md +0 -4
  131. package/node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthConfiguration.js +0 -1
  132. package/node_modules/@aws-sdk/middleware-signing/dist-cjs/awsAuthMiddleware.js +0 -1
  133. package/node_modules/@aws-sdk/middleware-signing/dist-cjs/index.js +0 -227
  134. package/node_modules/@aws-sdk/middleware-signing/dist-es/awsAuthConfiguration.js +0 -103
  135. package/node_modules/@aws-sdk/middleware-signing/dist-es/awsAuthMiddleware.js +0 -55
  136. package/node_modules/@aws-sdk/middleware-signing/dist-es/index.js +0 -2
  137. package/node_modules/@aws-sdk/middleware-signing/dist-es/utils/getSkewCorrectedDate.js +0 -1
  138. package/node_modules/@aws-sdk/middleware-signing/dist-es/utils/getUpdatedSystemClockOffset.js +0 -8
  139. package/node_modules/@aws-sdk/middleware-signing/dist-es/utils/isClockSkewed.js +0 -2
  140. package/node_modules/@aws-sdk/middleware-signing/dist-types/awsAuthConfiguration.d.ts +0 -99
  141. package/node_modules/@aws-sdk/middleware-signing/dist-types/awsAuthMiddleware.d.ts +0 -6
  142. package/node_modules/@aws-sdk/middleware-signing/dist-types/index.d.ts +0 -2
  143. package/node_modules/@aws-sdk/middleware-signing/dist-types/ts3.4/awsAuthConfiguration.d.ts +0 -68
  144. package/node_modules/@aws-sdk/middleware-signing/dist-types/ts3.4/awsAuthMiddleware.d.ts +0 -19
  145. package/node_modules/@aws-sdk/middleware-signing/dist-types/ts3.4/index.d.ts +0 -2
  146. package/node_modules/@aws-sdk/middleware-signing/dist-types/ts3.4/utils/getSkewCorrectedDate.d.ts +0 -1
  147. package/node_modules/@aws-sdk/middleware-signing/dist-types/ts3.4/utils/getUpdatedSystemClockOffset.d.ts +0 -4
  148. package/node_modules/@aws-sdk/middleware-signing/dist-types/ts3.4/utils/isClockSkewed.d.ts +0 -4
  149. package/node_modules/@aws-sdk/middleware-signing/dist-types/utils/getSkewCorrectedDate.d.ts +0 -6
  150. package/node_modules/@aws-sdk/middleware-signing/dist-types/utils/getUpdatedSystemClockOffset.d.ts +0 -8
  151. package/node_modules/@aws-sdk/middleware-signing/dist-types/utils/isClockSkewed.d.ts +0 -7
  152. package/node_modules/@aws-sdk/middleware-signing/package.json +0 -59
  153. /package/node_modules/@aws-sdk/{middleware-signing/dist-cjs/utils/getSkewCorrectedDate.js → client-cloudformation/dist-cjs/auth/httpAuthExtensionConfiguration.js} +0 -0
  154. /package/node_modules/@aws-sdk/{middleware-signing/dist-cjs/utils/isClockSkewed.js → client-sso/dist-cjs/auth/httpAuthExtensionConfiguration.js} +0 -0
  155. /package/node_modules/@aws-sdk/{middleware-signing/dist-cjs/utils/getUpdatedSystemClockOffset.js → client-sso-oidc/dist-cjs/auth/httpAuthExtensionConfiguration.js} +0 -0
@@ -1,227 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- awsAuthMiddleware: () => awsAuthMiddleware,
24
- awsAuthMiddlewareOptions: () => awsAuthMiddlewareOptions,
25
- getAwsAuthPlugin: () => getAwsAuthPlugin,
26
- getSigV4AuthPlugin: () => getSigV4AuthPlugin,
27
- resolveAwsAuthConfig: () => resolveAwsAuthConfig,
28
- resolveSigV4AuthConfig: () => resolveSigV4AuthConfig
29
- });
30
- module.exports = __toCommonJS(src_exports);
31
-
32
- // src/awsAuthConfiguration.ts
33
- var import_property_provider = require("@smithy/property-provider");
34
- var import_signature_v4 = require("@smithy/signature-v4");
35
- var import_util_middleware = require("@smithy/util-middleware");
36
- var CREDENTIAL_EXPIRE_WINDOW = 3e5;
37
- var resolveAwsAuthConfig = /* @__PURE__ */ __name((input) => {
38
- const normalizedCreds = input.credentials ? normalizeCredentialProvider(input.credentials) : input.credentialDefaultProvider(input);
39
- const { signingEscapePath = true, systemClockOffset = input.systemClockOffset || 0, sha256 } = input;
40
- let signer;
41
- if (input.signer) {
42
- signer = (0, import_util_middleware.normalizeProvider)(input.signer);
43
- } else if (input.regionInfoProvider) {
44
- signer = /* @__PURE__ */ __name(() => (0, import_util_middleware.normalizeProvider)(input.region)().then(
45
- async (region) => [
46
- await input.regionInfoProvider(region, {
47
- useFipsEndpoint: await input.useFipsEndpoint(),
48
- useDualstackEndpoint: await input.useDualstackEndpoint()
49
- }) || {},
50
- region
51
- ]
52
- ).then(([regionInfo, region]) => {
53
- const { signingRegion, signingService } = regionInfo;
54
- input.signingRegion = input.signingRegion || signingRegion || region;
55
- input.signingName = input.signingName || signingService || input.serviceId;
56
- const params = {
57
- ...input,
58
- credentials: normalizedCreds,
59
- region: input.signingRegion,
60
- service: input.signingName,
61
- sha256,
62
- uriEscapePath: signingEscapePath
63
- };
64
- const SignerCtor = input.signerConstructor || import_signature_v4.SignatureV4;
65
- return new SignerCtor(params);
66
- }), "signer");
67
- } else {
68
- signer = /* @__PURE__ */ __name(async (authScheme) => {
69
- authScheme = Object.assign(
70
- {},
71
- {
72
- name: "sigv4",
73
- signingName: input.signingName || input.defaultSigningName,
74
- signingRegion: await (0, import_util_middleware.normalizeProvider)(input.region)(),
75
- properties: {}
76
- },
77
- authScheme
78
- );
79
- const signingRegion = authScheme.signingRegion;
80
- const signingService = authScheme.signingName;
81
- input.signingRegion = input.signingRegion || signingRegion;
82
- input.signingName = input.signingName || signingService || input.serviceId;
83
- const params = {
84
- ...input,
85
- credentials: normalizedCreds,
86
- region: input.signingRegion,
87
- service: input.signingName,
88
- sha256,
89
- uriEscapePath: signingEscapePath
90
- };
91
- const SignerCtor = input.signerConstructor || import_signature_v4.SignatureV4;
92
- return new SignerCtor(params);
93
- }, "signer");
94
- }
95
- return {
96
- ...input,
97
- systemClockOffset,
98
- signingEscapePath,
99
- credentials: normalizedCreds,
100
- signer
101
- };
102
- }, "resolveAwsAuthConfig");
103
- var resolveSigV4AuthConfig = /* @__PURE__ */ __name((input) => {
104
- const normalizedCreds = input.credentials ? normalizeCredentialProvider(input.credentials) : input.credentialDefaultProvider(input);
105
- const { signingEscapePath = true, systemClockOffset = input.systemClockOffset || 0, sha256 } = input;
106
- let signer;
107
- if (input.signer) {
108
- signer = (0, import_util_middleware.normalizeProvider)(input.signer);
109
- } else {
110
- signer = (0, import_util_middleware.normalizeProvider)(
111
- new import_signature_v4.SignatureV4({
112
- credentials: normalizedCreds,
113
- region: input.region,
114
- service: input.signingName,
115
- sha256,
116
- uriEscapePath: signingEscapePath
117
- })
118
- );
119
- }
120
- return {
121
- ...input,
122
- systemClockOffset,
123
- signingEscapePath,
124
- credentials: normalizedCreds,
125
- signer
126
- };
127
- }, "resolveSigV4AuthConfig");
128
- var normalizeCredentialProvider = /* @__PURE__ */ __name((credentials) => {
129
- if (typeof credentials === "function") {
130
- return (0, import_property_provider.memoize)(
131
- credentials,
132
- (credentials2) => credentials2.expiration !== void 0 && credentials2.expiration.getTime() - Date.now() < CREDENTIAL_EXPIRE_WINDOW,
133
- (credentials2) => credentials2.expiration !== void 0
134
- );
135
- }
136
- return (0, import_util_middleware.normalizeProvider)(credentials);
137
- }, "normalizeCredentialProvider");
138
-
139
- // src/awsAuthMiddleware.ts
140
- var import_protocol_http = require("@smithy/protocol-http");
141
-
142
- // src/utils/getSkewCorrectedDate.ts
143
- var getSkewCorrectedDate = /* @__PURE__ */ __name((systemClockOffset) => new Date(Date.now() + systemClockOffset), "getSkewCorrectedDate");
144
-
145
- // src/utils/isClockSkewed.ts
146
- var isClockSkewed = /* @__PURE__ */ __name((clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 3e5, "isClockSkewed");
147
-
148
- // src/utils/getUpdatedSystemClockOffset.ts
149
- var getUpdatedSystemClockOffset = /* @__PURE__ */ __name((clockTime, currentSystemClockOffset) => {
150
- const clockTimeInMs = Date.parse(clockTime);
151
- if (isClockSkewed(clockTimeInMs, currentSystemClockOffset)) {
152
- return clockTimeInMs - Date.now();
153
- }
154
- return currentSystemClockOffset;
155
- }, "getUpdatedSystemClockOffset");
156
-
157
- // src/awsAuthMiddleware.ts
158
- var awsAuthMiddleware = /* @__PURE__ */ __name((options) => (next, context) => async function(args) {
159
- var _a, _b, _c, _d;
160
- if (!import_protocol_http.HttpRequest.isInstance(args.request))
161
- return next(args);
162
- const authScheme = (_c = (_b = (_a = context.endpointV2) == null ? void 0 : _a.properties) == null ? void 0 : _b.authSchemes) == null ? void 0 : _c[0];
163
- const multiRegionOverride = (authScheme == null ? void 0 : authScheme.name) === "sigv4a" ? (_d = authScheme == null ? void 0 : authScheme.signingRegionSet) == null ? void 0 : _d.join(",") : void 0;
164
- const signer = await options.signer(authScheme);
165
- let signedRequest;
166
- const signingOptions = {
167
- signingDate: getSkewCorrectedDate(options.systemClockOffset),
168
- signingRegion: multiRegionOverride || context["signing_region"],
169
- signingService: context["signing_service"]
170
- };
171
- if (context.s3ExpressIdentity) {
172
- const sigV4MultiRegion = signer;
173
- signedRequest = await sigV4MultiRegion.signWithCredentials(
174
- args.request,
175
- context.s3ExpressIdentity,
176
- signingOptions
177
- );
178
- if (signedRequest.headers["X-Amz-Security-Token"] || signedRequest.headers["x-amz-security-token"]) {
179
- throw new Error("X-Amz-Security-Token must not be set for s3-express requests.");
180
- }
181
- } else {
182
- signedRequest = await signer.sign(args.request, signingOptions);
183
- }
184
- const output = await next({
185
- ...args,
186
- request: signedRequest
187
- }).catch((error) => {
188
- const serverTime = error.ServerTime ?? getDateHeader(error.$response);
189
- if (serverTime) {
190
- options.systemClockOffset = getUpdatedSystemClockOffset(serverTime, options.systemClockOffset);
191
- }
192
- throw error;
193
- });
194
- const dateHeader = getDateHeader(output.response);
195
- if (dateHeader) {
196
- options.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, options.systemClockOffset);
197
- }
198
- return output;
199
- }, "awsAuthMiddleware");
200
- var getDateHeader = /* @__PURE__ */ __name((response) => {
201
- var _a, _b;
202
- return import_protocol_http.HttpResponse.isInstance(response) ? ((_a = response.headers) == null ? void 0 : _a.date) ?? ((_b = response.headers) == null ? void 0 : _b.Date) : void 0;
203
- }, "getDateHeader");
204
- var awsAuthMiddlewareOptions = {
205
- name: "awsAuthMiddleware",
206
- tags: ["SIGNATURE", "AWSAUTH"],
207
- relation: "after",
208
- toMiddleware: "retryMiddleware",
209
- override: true
210
- };
211
- var getAwsAuthPlugin = /* @__PURE__ */ __name((options) => ({
212
- applyToStack: (clientStack) => {
213
- clientStack.addRelativeTo(awsAuthMiddleware(options), awsAuthMiddlewareOptions);
214
- }
215
- }), "getAwsAuthPlugin");
216
- var getSigV4AuthPlugin = getAwsAuthPlugin;
217
- // Annotate the CommonJS export names for ESM import in node:
218
-
219
- 0 && (module.exports = {
220
- resolveAwsAuthConfig,
221
- resolveSigV4AuthConfig,
222
- awsAuthMiddleware,
223
- awsAuthMiddlewareOptions,
224
- getAwsAuthPlugin,
225
- getSigV4AuthPlugin
226
- });
227
-
@@ -1,103 +0,0 @@
1
- import { memoize } from "@smithy/property-provider";
2
- import { SignatureV4 } from "@smithy/signature-v4";
3
- import { normalizeProvider } from "@smithy/util-middleware";
4
- const CREDENTIAL_EXPIRE_WINDOW = 300000;
5
- export const resolveAwsAuthConfig = (input) => {
6
- const normalizedCreds = input.credentials
7
- ? normalizeCredentialProvider(input.credentials)
8
- : input.credentialDefaultProvider(input);
9
- const { signingEscapePath = true, systemClockOffset = input.systemClockOffset || 0, sha256 } = input;
10
- let signer;
11
- if (input.signer) {
12
- signer = normalizeProvider(input.signer);
13
- }
14
- else if (input.regionInfoProvider) {
15
- signer = () => normalizeProvider(input.region)()
16
- .then(async (region) => [
17
- (await input.regionInfoProvider(region, {
18
- useFipsEndpoint: await input.useFipsEndpoint(),
19
- useDualstackEndpoint: await input.useDualstackEndpoint(),
20
- })) || {},
21
- region,
22
- ])
23
- .then(([regionInfo, region]) => {
24
- const { signingRegion, signingService } = regionInfo;
25
- input.signingRegion = input.signingRegion || signingRegion || region;
26
- input.signingName = input.signingName || signingService || input.serviceId;
27
- const params = {
28
- ...input,
29
- credentials: normalizedCreds,
30
- region: input.signingRegion,
31
- service: input.signingName,
32
- sha256,
33
- uriEscapePath: signingEscapePath,
34
- };
35
- const SignerCtor = input.signerConstructor || SignatureV4;
36
- return new SignerCtor(params);
37
- });
38
- }
39
- else {
40
- signer = async (authScheme) => {
41
- authScheme = Object.assign({}, {
42
- name: "sigv4",
43
- signingName: input.signingName || input.defaultSigningName,
44
- signingRegion: await normalizeProvider(input.region)(),
45
- properties: {},
46
- }, authScheme);
47
- const signingRegion = authScheme.signingRegion;
48
- const signingService = authScheme.signingName;
49
- input.signingRegion = input.signingRegion || signingRegion;
50
- input.signingName = input.signingName || signingService || input.serviceId;
51
- const params = {
52
- ...input,
53
- credentials: normalizedCreds,
54
- region: input.signingRegion,
55
- service: input.signingName,
56
- sha256,
57
- uriEscapePath: signingEscapePath,
58
- };
59
- const SignerCtor = input.signerConstructor || SignatureV4;
60
- return new SignerCtor(params);
61
- };
62
- }
63
- return {
64
- ...input,
65
- systemClockOffset,
66
- signingEscapePath,
67
- credentials: normalizedCreds,
68
- signer,
69
- };
70
- };
71
- export const resolveSigV4AuthConfig = (input) => {
72
- const normalizedCreds = input.credentials
73
- ? normalizeCredentialProvider(input.credentials)
74
- : input.credentialDefaultProvider(input);
75
- const { signingEscapePath = true, systemClockOffset = input.systemClockOffset || 0, sha256 } = input;
76
- let signer;
77
- if (input.signer) {
78
- signer = normalizeProvider(input.signer);
79
- }
80
- else {
81
- signer = normalizeProvider(new SignatureV4({
82
- credentials: normalizedCreds,
83
- region: input.region,
84
- service: input.signingName,
85
- sha256,
86
- uriEscapePath: signingEscapePath,
87
- }));
88
- }
89
- return {
90
- ...input,
91
- systemClockOffset,
92
- signingEscapePath,
93
- credentials: normalizedCreds,
94
- signer,
95
- };
96
- };
97
- const normalizeCredentialProvider = (credentials) => {
98
- if (typeof credentials === "function") {
99
- return memoize(credentials, (credentials) => credentials.expiration !== undefined &&
100
- credentials.expiration.getTime() - Date.now() < CREDENTIAL_EXPIRE_WINDOW, (credentials) => credentials.expiration !== undefined);
101
- }
102
- return normalizeProvider(credentials);
103
- };
@@ -1,55 +0,0 @@
1
- import { HttpRequest, HttpResponse } from "@smithy/protocol-http";
2
- import { getSkewCorrectedDate } from "./utils/getSkewCorrectedDate";
3
- import { getUpdatedSystemClockOffset } from "./utils/getUpdatedSystemClockOffset";
4
- export const awsAuthMiddleware = (options) => (next, context) => async function (args) {
5
- if (!HttpRequest.isInstance(args.request))
6
- return next(args);
7
- const authScheme = context.endpointV2?.properties?.authSchemes?.[0];
8
- const multiRegionOverride = authScheme?.name === "sigv4a" ? authScheme?.signingRegionSet?.join(",") : undefined;
9
- const signer = await options.signer(authScheme);
10
- let signedRequest;
11
- const signingOptions = {
12
- signingDate: getSkewCorrectedDate(options.systemClockOffset),
13
- signingRegion: multiRegionOverride || context["signing_region"],
14
- signingService: context["signing_service"],
15
- };
16
- if (context.s3ExpressIdentity) {
17
- const sigV4MultiRegion = signer;
18
- signedRequest = await sigV4MultiRegion.signWithCredentials(args.request, context.s3ExpressIdentity, signingOptions);
19
- if (signedRequest.headers["X-Amz-Security-Token"] || signedRequest.headers["x-amz-security-token"]) {
20
- throw new Error("X-Amz-Security-Token must not be set for s3-express requests.");
21
- }
22
- }
23
- else {
24
- signedRequest = await signer.sign(args.request, signingOptions);
25
- }
26
- const output = await next({
27
- ...args,
28
- request: signedRequest,
29
- }).catch((error) => {
30
- const serverTime = error.ServerTime ?? getDateHeader(error.$response);
31
- if (serverTime) {
32
- options.systemClockOffset = getUpdatedSystemClockOffset(serverTime, options.systemClockOffset);
33
- }
34
- throw error;
35
- });
36
- const dateHeader = getDateHeader(output.response);
37
- if (dateHeader) {
38
- options.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, options.systemClockOffset);
39
- }
40
- return output;
41
- };
42
- const getDateHeader = (response) => HttpResponse.isInstance(response) ? response.headers?.date ?? response.headers?.Date : undefined;
43
- export const awsAuthMiddlewareOptions = {
44
- name: "awsAuthMiddleware",
45
- tags: ["SIGNATURE", "AWSAUTH"],
46
- relation: "after",
47
- toMiddleware: "retryMiddleware",
48
- override: true,
49
- };
50
- export const getAwsAuthPlugin = (options) => ({
51
- applyToStack: (clientStack) => {
52
- clientStack.addRelativeTo(awsAuthMiddleware(options), awsAuthMiddlewareOptions);
53
- },
54
- });
55
- export const getSigV4AuthPlugin = getAwsAuthPlugin;
@@ -1,2 +0,0 @@
1
- export * from "./awsAuthConfiguration";
2
- export * from "./awsAuthMiddleware";
@@ -1 +0,0 @@
1
- export const getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset);
@@ -1,8 +0,0 @@
1
- import { isClockSkewed } from "./isClockSkewed";
2
- export const getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => {
3
- const clockTimeInMs = Date.parse(clockTime);
4
- if (isClockSkewed(clockTimeInMs, currentSystemClockOffset)) {
5
- return clockTimeInMs - Date.now();
6
- }
7
- return currentSystemClockOffset;
8
- };
@@ -1,2 +0,0 @@
1
- import { getSkewCorrectedDate } from "./getSkewCorrectedDate";
2
- export const isClockSkewed = (clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 300000;
@@ -1,99 +0,0 @@
1
- import { SignatureV4CryptoInit, SignatureV4Init } from "@smithy/signature-v4";
2
- import { AuthScheme, AwsCredentialIdentity, ChecksumConstructor, HashConstructor, Logger, MemoizedProvider, Provider, RegionInfoProvider, RequestSigner } from "@smithy/types";
3
- /**
4
- * @public
5
- */
6
- export interface AwsAuthInputConfig {
7
- /**
8
- * The credentials used to sign requests.
9
- */
10
- credentials?: AwsCredentialIdentity | Provider<AwsCredentialIdentity>;
11
- /**
12
- * The signer to use when signing requests.
13
- */
14
- signer?: RequestSigner | ((authScheme?: AuthScheme) => Promise<RequestSigner>);
15
- /**
16
- * Whether to escape request path when signing the request.
17
- */
18
- signingEscapePath?: boolean;
19
- /**
20
- * An offset value in milliseconds to apply to all signing times.
21
- */
22
- systemClockOffset?: number;
23
- /**
24
- * The region where you want to sign your request against. This
25
- * can be different to the region in the endpoint.
26
- */
27
- signingRegion?: string;
28
- /**
29
- * The injectable SigV4-compatible signer class constructor. If not supplied,
30
- * regular SignatureV4 constructor will be used.
31
- *
32
- * @internal
33
- */
34
- signerConstructor?: new (options: SignatureV4Init & SignatureV4CryptoInit) => RequestSigner;
35
- }
36
- /**
37
- * @public
38
- */
39
- export interface SigV4AuthInputConfig {
40
- /**
41
- * The credentials used to sign requests.
42
- */
43
- credentials?: AwsCredentialIdentity | Provider<AwsCredentialIdentity>;
44
- /**
45
- * The signer to use when signing requests.
46
- */
47
- signer?: RequestSigner | ((authScheme?: AuthScheme) => Promise<RequestSigner>);
48
- /**
49
- * Whether to escape request path when signing the request.
50
- */
51
- signingEscapePath?: boolean;
52
- /**
53
- * An offset value in milliseconds to apply to all signing times.
54
- */
55
- systemClockOffset?: number;
56
- }
57
- interface PreviouslyResolved {
58
- credentialDefaultProvider: (input: any) => MemoizedProvider<AwsCredentialIdentity>;
59
- region: string | Provider<string>;
60
- regionInfoProvider?: RegionInfoProvider;
61
- signingName?: string;
62
- defaultSigningName?: string;
63
- serviceId: string;
64
- sha256: ChecksumConstructor | HashConstructor;
65
- useFipsEndpoint: Provider<boolean>;
66
- useDualstackEndpoint: Provider<boolean>;
67
- }
68
- interface SigV4PreviouslyResolved {
69
- credentialDefaultProvider: (input: any) => MemoizedProvider<AwsCredentialIdentity>;
70
- region: string | Provider<string>;
71
- signingName: string;
72
- sha256: ChecksumConstructor | HashConstructor;
73
- logger?: Logger;
74
- }
75
- export interface AwsAuthResolvedConfig {
76
- /**
77
- * Resolved value for input config {@link AwsAuthInputConfig.credentials}
78
- * This provider MAY memoize the loaded credentials for certain period.
79
- * See {@link MemoizedProvider} for more information.
80
- */
81
- credentials: MemoizedProvider<AwsCredentialIdentity>;
82
- /**
83
- * Resolved value for input config {@link AwsAuthInputConfig.signer}
84
- */
85
- signer: (authScheme?: AuthScheme) => Promise<RequestSigner>;
86
- /**
87
- * Resolved value for input config {@link AwsAuthInputConfig.signingEscapePath}
88
- */
89
- signingEscapePath: boolean;
90
- /**
91
- * Resolved value for input config {@link AwsAuthInputConfig.systemClockOffset}
92
- */
93
- systemClockOffset: number;
94
- }
95
- export interface SigV4AuthResolvedConfig extends AwsAuthResolvedConfig {
96
- }
97
- export declare const resolveAwsAuthConfig: <T>(input: T & AwsAuthInputConfig & PreviouslyResolved) => T & AwsAuthResolvedConfig;
98
- export declare const resolveSigV4AuthConfig: <T>(input: T & SigV4AuthInputConfig & SigV4PreviouslyResolved) => T & SigV4AuthResolvedConfig;
99
- export {};
@@ -1,6 +0,0 @@
1
- import { FinalizeRequestMiddleware, Pluggable, RelativeMiddlewareOptions } from "@smithy/types";
2
- import { AwsAuthResolvedConfig } from "./awsAuthConfiguration";
3
- export declare const awsAuthMiddleware: <Input extends object, Output extends object>(options: AwsAuthResolvedConfig) => FinalizeRequestMiddleware<Input, Output>;
4
- export declare const awsAuthMiddlewareOptions: RelativeMiddlewareOptions;
5
- export declare const getAwsAuthPlugin: (options: AwsAuthResolvedConfig) => Pluggable<any, any>;
6
- export declare const getSigV4AuthPlugin: (options: AwsAuthResolvedConfig) => Pluggable<any, any>;
@@ -1,2 +0,0 @@
1
- export * from "./awsAuthConfiguration";
2
- export * from "./awsAuthMiddleware";
@@ -1,68 +0,0 @@
1
- import { SignatureV4CryptoInit, SignatureV4Init } from "@smithy/signature-v4";
2
- import {
3
- AuthScheme,
4
- AwsCredentialIdentity,
5
- ChecksumConstructor,
6
- HashConstructor,
7
- Logger,
8
- MemoizedProvider,
9
- Provider,
10
- RegionInfoProvider,
11
- RequestSigner,
12
- } from "@smithy/types";
13
- export interface AwsAuthInputConfig {
14
- credentials?: AwsCredentialIdentity | Provider<AwsCredentialIdentity>;
15
- signer?:
16
- | RequestSigner
17
- | ((authScheme?: AuthScheme) => Promise<RequestSigner>);
18
- signingEscapePath?: boolean;
19
- systemClockOffset?: number;
20
- signingRegion?: string;
21
- signerConstructor?: new (
22
- options: SignatureV4Init & SignatureV4CryptoInit
23
- ) => RequestSigner;
24
- }
25
- export interface SigV4AuthInputConfig {
26
- credentials?: AwsCredentialIdentity | Provider<AwsCredentialIdentity>;
27
- signer?:
28
- | RequestSigner
29
- | ((authScheme?: AuthScheme) => Promise<RequestSigner>);
30
- signingEscapePath?: boolean;
31
- systemClockOffset?: number;
32
- }
33
- interface PreviouslyResolved {
34
- credentialDefaultProvider: (
35
- input: any
36
- ) => MemoizedProvider<AwsCredentialIdentity>;
37
- region: string | Provider<string>;
38
- regionInfoProvider?: RegionInfoProvider;
39
- signingName?: string;
40
- defaultSigningName?: string;
41
- serviceId: string;
42
- sha256: ChecksumConstructor | HashConstructor;
43
- useFipsEndpoint: Provider<boolean>;
44
- useDualstackEndpoint: Provider<boolean>;
45
- }
46
- interface SigV4PreviouslyResolved {
47
- credentialDefaultProvider: (
48
- input: any
49
- ) => MemoizedProvider<AwsCredentialIdentity>;
50
- region: string | Provider<string>;
51
- signingName: string;
52
- sha256: ChecksumConstructor | HashConstructor;
53
- logger?: Logger;
54
- }
55
- export interface AwsAuthResolvedConfig {
56
- credentials: MemoizedProvider<AwsCredentialIdentity>;
57
- signer: (authScheme?: AuthScheme) => Promise<RequestSigner>;
58
- signingEscapePath: boolean;
59
- systemClockOffset: number;
60
- }
61
- export interface SigV4AuthResolvedConfig extends AwsAuthResolvedConfig {}
62
- export declare const resolveAwsAuthConfig: <T>(
63
- input: T & AwsAuthInputConfig & PreviouslyResolved
64
- ) => T & AwsAuthResolvedConfig;
65
- export declare const resolveSigV4AuthConfig: <T>(
66
- input: T & SigV4AuthInputConfig & SigV4PreviouslyResolved
67
- ) => T & SigV4AuthResolvedConfig;
68
- export {};
@@ -1,19 +0,0 @@
1
- import {
2
- FinalizeRequestMiddleware,
3
- Pluggable,
4
- RelativeMiddlewareOptions,
5
- } from "@smithy/types";
6
- import { AwsAuthResolvedConfig } from "./awsAuthConfiguration";
7
- export declare const awsAuthMiddleware: <
8
- Input extends object,
9
- Output extends object
10
- >(
11
- options: AwsAuthResolvedConfig
12
- ) => FinalizeRequestMiddleware<Input, Output>;
13
- export declare const awsAuthMiddlewareOptions: RelativeMiddlewareOptions;
14
- export declare const getAwsAuthPlugin: (
15
- options: AwsAuthResolvedConfig
16
- ) => Pluggable<any, any>;
17
- export declare const getSigV4AuthPlugin: (
18
- options: AwsAuthResolvedConfig
19
- ) => Pluggable<any, any>;
@@ -1,2 +0,0 @@
1
- export * from "./awsAuthConfiguration";
2
- export * from "./awsAuthMiddleware";
@@ -1 +0,0 @@
1
- export declare const getSkewCorrectedDate: (systemClockOffset: number) => Date;
@@ -1,4 +0,0 @@
1
- export declare const getUpdatedSystemClockOffset: (
2
- clockTime: string,
3
- currentSystemClockOffset: number
4
- ) => number;
@@ -1,4 +0,0 @@
1
- export declare const isClockSkewed: (
2
- clockTime: number,
3
- systemClockOffset: number
4
- ) => boolean;
@@ -1,6 +0,0 @@
1
- /**
2
- * Returns a date that is corrected for clock skew.
3
- *
4
- * @param systemClockOffset The offset of the system clock in milliseconds.
5
- */
6
- export declare const getSkewCorrectedDate: (systemClockOffset: number) => Date;
@@ -1,8 +0,0 @@
1
- /**
2
- * If clock is skewed, it returns the difference between serverTime and current time.
3
- * If clock is not skewed, it returns currentSystemClockOffset.
4
- *
5
- * @param clockTime The string value of the server time.
6
- * @param currentSystemClockOffset The current system clock offset.
7
- */
8
- export declare const getUpdatedSystemClockOffset: (clockTime: string, currentSystemClockOffset: number) => number;
@@ -1,7 +0,0 @@
1
- /**
2
- * Checks if the provided date is within the skew window of 300000ms.
3
- *
4
- * @param clockTime - The time to check for skew in milliseconds.
5
- * @param systemClockOffset - The offset of the system clock in milliseconds.
6
- */
7
- export declare const isClockSkewed: (clockTime: number, systemClockOffset: number) => boolean;