-
-
Save syall/72886efc2450c04f73495351188ed61e to your computer and use it in GitHub Desktop.
pr-#5169.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/package.json ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/package.json | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/package.json 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/package.json 2023-09-05 15:27:52 | |
@@ -10,8 +10,7 @@ | |
"build:types": "tsc -p tsconfig.types.json", | |
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", | |
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo", | |
- "prepack": "yarn run clean && yarn run build", | |
- "test": "vitest run" | |
+ "prepack": "yarn run clean && yarn run build" | |
}, | |
"main": "./dist-cjs/index.js", | |
"types": "./dist-types/index.d.ts", | |
@@ -21,18 +20,16 @@ | |
"tslib": "^2.5.0", | |
"@aws-crypto/sha256-browser": "3.0.0", | |
"@aws-crypto/sha256-js": "3.0.0", | |
- "@aws-sdk/client-sts": "3.405.0", | |
- "@aws-sdk/credential-provider-node": "3.405.0", | |
"@aws-sdk/middleware-host-header": "3.398.0", | |
"@aws-sdk/middleware-logger": "3.398.0", | |
"@aws-sdk/middleware-recursion-detection": "3.398.0", | |
- "@aws-sdk/middleware-signing": "3.398.0", | |
- "@aws-sdk/middleware-token": "3.405.0", | |
"@aws-sdk/middleware-user-agent": "3.398.0", | |
+ "@aws-sdk/token-providers": "3.405.0", | |
"@aws-sdk/types": "3.398.0", | |
"@aws-sdk/util-user-agent-browser": "3.398.0", | |
"@aws-sdk/util-user-agent-node": "3.405.0", | |
"@smithy/config-resolver": "^2.0.5", | |
+ "@smithy/experimental-identity-and-auth": "~0.0.1", | |
"@smithy/fetch-http-handler": "^2.0.5", | |
"@smithy/hash-node": "^2.0.5", | |
"@smithy/invalid-dependency": "^2.0.5", | |
@@ -63,8 +60,7 @@ | |
"typedoc": "0.23.23", | |
"typescript": "~4.9.5", | |
"@smithy/service-client-documentation-generator": "^2.0.0", | |
- "@types/node": "^14.14.31", | |
- "vitest": "^0.33.0" | |
+ "@types/node": "^14.14.31" | |
}, | |
"engines": { | |
"node": ">=14.0.0" | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/WeatherClient.ts ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/WeatherClient.ts | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/WeatherClient.ts 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/WeatherClient.ts 2023-09-05 15:27:52 | |
@@ -1,4 +1,5 @@ | |
// smithy-typescript generated code | |
+import { WeatherHttpAuthSchemeProvider } from "./auth/httpAuthSchemeProvider"; | |
import { | |
OnlyCustomAuthCommandInput, | |
OnlyCustomAuthCommandOutput, | |
@@ -43,11 +44,6 @@ | |
SameAsServiceCommandInput, | |
SameAsServiceCommandOutput, | |
} from "./commands/SameAsServiceCommand"; | |
-import { | |
- HttpApiKeyAuthInputConfig, | |
- HttpApiKeyAuthResolvedConfig, | |
- resolveHttpApiKeyAuthConfig, | |
-} from "./middleware/HttpApiKeyAuth"; | |
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; | |
import { | |
RuntimeExtension, | |
@@ -63,31 +59,23 @@ | |
import { getLoggerPlugin } from "@aws-sdk/middleware-logger"; | |
import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection"; | |
import { | |
- SigV4AuthInputConfig, | |
- SigV4AuthResolvedConfig, | |
- resolveSigV4AuthConfig, | |
-} from "@aws-sdk/middleware-signing"; | |
-import { | |
- TokenInputConfig, | |
- TokenResolvedConfig, | |
- getTokenPlugin, | |
- resolveTokenConfig, | |
-} from "@aws-sdk/middleware-token"; | |
-import { | |
UserAgentInputConfig, | |
UserAgentResolvedConfig, | |
getUserAgentPlugin, | |
resolveUserAgentConfig, | |
} from "@aws-sdk/middleware-user-agent"; | |
-import { Credentials as __Credentials } from "@aws-sdk/types"; | |
import { | |
CustomEndpointsInputConfig, | |
CustomEndpointsResolvedConfig, | |
- RegionInputConfig, | |
- RegionResolvedConfig, | |
resolveCustomEndpointsConfig, | |
- resolveRegionConfig, | |
} from "@smithy/config-resolver"; | |
+import { | |
+ ApiKeyIdentity, | |
+ ApiKeyIdentityProvider, | |
+ HttpAuthScheme, | |
+ TokenIdentity, | |
+ TokenIdentityProvider, | |
+} from "@smithy/experimental-identity-and-auth"; | |
import { getContentLengthPlugin } from "@smithy/middleware-content-length"; | |
import { | |
RetryInputConfig, | |
@@ -103,6 +91,8 @@ | |
SmithyResolvedConfiguration as __SmithyResolvedConfiguration, | |
} from "@smithy/smithy-client"; | |
import { | |
+ AwsCredentialIdentity, | |
+ AwsCredentialIdentityProvider, | |
Provider, | |
BodyLengthCalculator as __BodyLengthCalculator, | |
CheckOptionalClientConfig as __CheckOptionalClientConfig, | |
@@ -226,21 +216,16 @@ | |
disableHostPrefix?: boolean; | |
/** | |
- * The AWS region to use as signing region for AWS Auth | |
- */ | |
- region?: string | __Provider<string>; | |
- | |
- /** | |
- * The service name to use as the signing service for AWS Auth | |
+ * experimentalIdentityAndAuth: Configuration of HttpAuthSchemes for a client which provides default identity providers and signers per auth scheme. | |
* @internal | |
*/ | |
- signingName?: string; | |
+ httpAuthSchemes?: HttpAuthScheme[]; | |
/** | |
- * Default credentials provider; Not available in browser runtime. | |
+ * experimentalIdentityAndAuth: Configuration of an HttpAuthSchemeProvider for a client which resolves which HttpAuthScheme to use. | |
* @internal | |
*/ | |
- credentialDefaultProvider?: (input: any) => __Provider<__Credentials>; | |
+ httpAuthSchemeProvider?: WeatherHttpAuthSchemeProvider; | |
/** | |
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header | |
@@ -273,6 +258,26 @@ | |
*/ | |
defaultsMode?: __DefaultsMode | __Provider<__DefaultsMode>; | |
+ /** | |
+ * The API key to use when making requests. | |
+ */ | |
+ apiKey?: ApiKeyIdentity | ApiKeyIdentityProvider; | |
+ | |
+ /** | |
+ * The token used to authenticate requests. | |
+ */ | |
+ token?: TokenIdentity | TokenIdentityProvider; | |
+ | |
+ /** | |
+ * The AWS region to which this client will send requests. | |
+ */ | |
+ region?: string | __Provider<string>; | |
+ | |
+ /** | |
+ * The credentials used to sign requests. | |
+ */ | |
+ credentials?: AwsCredentialIdentity | AwsCredentialIdentityProvider; | |
+ | |
} | |
/** | |
@@ -280,14 +285,10 @@ | |
*/ | |
export type WeatherClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> | |
& ClientDefaults | |
- & RegionInputConfig | |
& CustomEndpointsInputConfig | |
& RetryInputConfig | |
& HostHeaderInputConfig | |
- & SigV4AuthInputConfig | |
- & TokenInputConfig | |
& UserAgentInputConfig | |
- & HttpApiKeyAuthInputConfig | |
/** | |
* @public | |
* | |
@@ -301,14 +302,10 @@ | |
export type WeatherClientResolvedConfigType = __SmithyResolvedConfiguration<__HttpHandlerOptions> | |
& Required<ClientDefaults> | |
& RuntimeExtensionsConfig | |
- & RegionResolvedConfig | |
& CustomEndpointsResolvedConfig | |
& RetryResolvedConfig | |
& HostHeaderResolvedConfig | |
- & SigV4AuthResolvedConfig | |
- & TokenResolvedConfig | |
& UserAgentResolvedConfig | |
- & HttpApiKeyAuthResolvedConfig | |
/** | |
* @public | |
* | |
@@ -332,23 +329,18 @@ | |
constructor(...[configuration]: __CheckOptionalClientConfig<WeatherClientConfig>) { | |
let _config_0 = __getRuntimeConfig(configuration || {}); | |
- let _config_1 = resolveRegionConfig(_config_0); | |
- let _config_2 = resolveCustomEndpointsConfig(_config_1); | |
- let _config_3 = resolveRetryConfig(_config_2); | |
- let _config_4 = resolveHostHeaderConfig(_config_3); | |
- let _config_5 = resolveSigV4AuthConfig(_config_4); | |
- let _config_6 = resolveTokenConfig(_config_5); | |
- let _config_7 = resolveUserAgentConfig(_config_6); | |
- let _config_8 = resolveHttpApiKeyAuthConfig(_config_7); | |
- let _config_9 = resolveRuntimeExtensions(_config_8, configuration?.extensions || []); | |
- super(_config_9); | |
- this.config = _config_9; | |
+ let _config_1 = resolveCustomEndpointsConfig(_config_0); | |
+ let _config_2 = resolveRetryConfig(_config_1); | |
+ let _config_3 = resolveHostHeaderConfig(_config_2); | |
+ let _config_4 = resolveUserAgentConfig(_config_3); | |
+ let _config_5 = resolveRuntimeExtensions(_config_4, configuration?.extensions || []); | |
+ super(_config_5); | |
+ this.config = _config_5; | |
this.middlewareStack.use(getRetryPlugin(this.config)); | |
this.middlewareStack.use(getContentLengthPlugin(this.config)); | |
this.middlewareStack.use(getHostHeaderPlugin(this.config)); | |
this.middlewareStack.use(getLoggerPlugin(this.config)); | |
this.middlewareStack.use(getRecursionDetectionPlugin(this.config)); | |
- this.middlewareStack.use(getTokenPlugin(this.config)); | |
this.middlewareStack.use(getUserAgentPlugin(this.config)); | |
} | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/auth/httpAuthSchemeProvider.ts ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/auth/httpAuthSchemeProvider.ts | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/auth/httpAuthSchemeProvider.ts 1969-12-31 16:00:00 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/auth/httpAuthSchemeProvider.ts 2023-09-05 15:27:52 | |
@@ -0,0 +1,132 @@ | |
+// smithy-typescript generated code | |
+import { WeatherClientResolvedConfig } from "../WeatherClient"; | |
+import { | |
+ HttpApiKeyAuthLocation, | |
+ HttpAuthOption, | |
+} from "@smithy/experimental-identity-and-auth"; | |
+import { HandlerExecutionContext } from "@smithy/types"; | |
+import { normalizeProvider } from "@smithy/util-middleware"; | |
+ | |
+/** | |
+ * @internal | |
+ */ | |
+export interface WeatherHttpAuthSchemeParameters { | |
+ operation?: string; | |
+ region?: string; | |
+} | |
+ | |
+/** | |
+ * @internal | |
+ */ | |
+export async function defaultWeatherHttpAuthSchemeParametersProvider( | |
+ config: WeatherClientResolvedConfig, | |
+ context: HandlerExecutionContext | |
+): Promise<WeatherHttpAuthSchemeParameters> { | |
+ return { | |
+ operation: context.commandName, | |
+ region: await normalizeProvider(config.region)() || (() => { | |
+ throw new Error("expected `region` to be configured for `aws.auth#sigv4`"); | |
+ })(), | |
+ }; | |
+}; | |
+ | |
+function createAwsAuthSigv4HttpAuthOption(authParameters: WeatherHttpAuthSchemeParameters): HttpAuthOption { | |
+ return { | |
+ schemeId: "aws.auth#sigv4", | |
+ signingProperties: { | |
+ name: "weather", | |
+ region: authParameters.region, | |
+ }, | |
+ }; | |
+}; | |
+ | |
+function createExampleWeatherCustomAuthHttpAuthOption(authParameters: WeatherHttpAuthSchemeParameters): HttpAuthOption { | |
+ return { | |
+ schemeId: "example.weather#customAuth", | |
+ }; | |
+}; | |
+ | |
+function createSmithyApiHttpApiKeyAuthHttpAuthOption(authParameters: WeatherHttpAuthSchemeParameters): HttpAuthOption { | |
+ return { | |
+ schemeId: "smithy.api#httpApiKeyAuth", | |
+ signingProperties: { | |
+ name: "X-Api-Key", | |
+ in: HttpApiKeyAuthLocation.HEADER, | |
+ scheme: undefined, | |
+ }, | |
+ }; | |
+}; | |
+ | |
+function createSmithyApiHttpBearerAuthHttpAuthOption(authParameters: WeatherHttpAuthSchemeParameters): HttpAuthOption { | |
+ return { | |
+ schemeId: "smithy.api#httpBearerAuth", | |
+ }; | |
+}; | |
+ | |
+function createSmithyApiNoAuthHttpAuthOption(authParameters: WeatherHttpAuthSchemeParameters): HttpAuthOption { | |
+ return { | |
+ schemeId: "smithy.api#noAuth", | |
+ }; | |
+}; | |
+ | |
+/** | |
+ * @internal | |
+ */ | |
+export interface WeatherHttpAuthSchemeProvider { | |
+ (authParameters: WeatherHttpAuthSchemeParameters): HttpAuthOption[]; | |
+} | |
+ | |
+/** | |
+ * @internal | |
+ */ | |
+export function defaultWeatherHttpAuthSchemeProvider(authParameters: WeatherHttpAuthSchemeParameters): HttpAuthOption[] { | |
+ const options: HttpAuthOption[] = []; | |
+ switch (authParameters.operation) { | |
+ case "OnlyHttpApiKeyAuth": { | |
+ options.push(createSmithyApiHttpApiKeyAuthHttpAuthOption(authParameters)); | |
+ break; | |
+ }; | |
+ case "OnlyHttpApiKeyAuthOptional": { | |
+ options.push(createSmithyApiHttpApiKeyAuthHttpAuthOption(authParameters)); | |
+ options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); | |
+ break; | |
+ }; | |
+ case "OnlyHttpBearerAuth": { | |
+ options.push(createSmithyApiHttpBearerAuthHttpAuthOption(authParameters)); | |
+ break; | |
+ }; | |
+ case "OnlyHttpBearerAuthOptional": { | |
+ options.push(createSmithyApiHttpBearerAuthHttpAuthOption(authParameters)); | |
+ options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); | |
+ break; | |
+ }; | |
+ case "OnlyHttpApiKeyAndBearerAuth": { | |
+ options.push(createSmithyApiHttpApiKeyAuthHttpAuthOption(authParameters)); | |
+ options.push(createSmithyApiHttpBearerAuthHttpAuthOption(authParameters)); | |
+ break; | |
+ }; | |
+ case "OnlyHttpApiKeyAndBearerAuthReversed": { | |
+ options.push(createSmithyApiHttpBearerAuthHttpAuthOption(authParameters)); | |
+ options.push(createSmithyApiHttpApiKeyAuthHttpAuthOption(authParameters)); | |
+ break; | |
+ }; | |
+ case "OnlySigv4AuthOptional": { | |
+ options.push(createAwsAuthSigv4HttpAuthOption(authParameters)); | |
+ options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); | |
+ break; | |
+ }; | |
+ case "OnlyCustomAuth": { | |
+ options.push(createExampleWeatherCustomAuthHttpAuthOption(authParameters)); | |
+ break; | |
+ }; | |
+ case "OnlyCustomAuthOptional": { | |
+ options.push(createExampleWeatherCustomAuthHttpAuthOption(authParameters)); | |
+ options.push(createSmithyApiNoAuthHttpAuthOption(authParameters)); | |
+ break; | |
+ }; | |
+ default: { | |
+ options.push(createAwsAuthSigv4HttpAuthOption(authParameters)); | |
+ }; | |
+ }; | |
+ return options; | |
+}; | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyCustomAuthCommand.ts ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyCustomAuthCommand.ts | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyCustomAuthCommand.ts 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyCustomAuthCommand.ts 2023-09-05 15:27:52 | |
@@ -4,7 +4,6 @@ | |
ServiceOutputTypes, | |
WeatherClientResolvedConfig, | |
} from "../WeatherClient"; | |
-import { getSigV4AuthPlugin } from "@aws-sdk/middleware-signing"; | |
import { getSerdePlugin } from "@smithy/middleware-serde"; | |
import { | |
HttpRequest as __HttpRequest, | |
@@ -60,7 +59,6 @@ | |
options?: __HttpHandlerOptions | |
): Handler<OnlyCustomAuthCommandInput, OnlyCustomAuthCommandOutput> { | |
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); | |
- this.middlewareStack.use(getSigV4AuthPlugin(configuration)); | |
const stack = clientStack.concat(this.middlewareStack); | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpApiKeyAndBearerAuthCommand.ts ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpApiKeyAndBearerAuthCommand.ts | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpApiKeyAndBearerAuthCommand.ts 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpApiKeyAndBearerAuthCommand.ts 2023-09-05 15:27:52 | |
@@ -4,8 +4,6 @@ | |
ServiceOutputTypes, | |
WeatherClientResolvedConfig, | |
} from "../WeatherClient"; | |
-import { getHttpApiKeyAuthPlugin } from "../middleware/HttpApiKeyAuth"; | |
-import { getSigV4AuthPlugin } from "@aws-sdk/middleware-signing"; | |
import { getSerdePlugin } from "@smithy/middleware-serde"; | |
import { | |
HttpRequest as __HttpRequest, | |
@@ -61,8 +59,6 @@ | |
options?: __HttpHandlerOptions | |
): Handler<OnlyHttpApiKeyAndBearerAuthCommandInput, OnlyHttpApiKeyAndBearerAuthCommandOutput> { | |
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); | |
- this.middlewareStack.use(getSigV4AuthPlugin(configuration)); | |
- this.middlewareStack.use(getHttpApiKeyAuthPlugin(configuration, { in: 'header', name: 'X-Api-Key'})); | |
const stack = clientStack.concat(this.middlewareStack); | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpApiKeyAndBearerAuthReversedCommand.ts ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpApiKeyAndBearerAuthReversedCommand.ts | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpApiKeyAndBearerAuthReversedCommand.ts 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpApiKeyAndBearerAuthReversedCommand.ts 2023-09-05 15:27:52 | |
@@ -4,8 +4,6 @@ | |
ServiceOutputTypes, | |
WeatherClientResolvedConfig, | |
} from "../WeatherClient"; | |
-import { getHttpApiKeyAuthPlugin } from "../middleware/HttpApiKeyAuth"; | |
-import { getSigV4AuthPlugin } from "@aws-sdk/middleware-signing"; | |
import { getSerdePlugin } from "@smithy/middleware-serde"; | |
import { | |
HttpRequest as __HttpRequest, | |
@@ -61,8 +59,6 @@ | |
options?: __HttpHandlerOptions | |
): Handler<OnlyHttpApiKeyAndBearerAuthReversedCommandInput, OnlyHttpApiKeyAndBearerAuthReversedCommandOutput> { | |
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); | |
- this.middlewareStack.use(getSigV4AuthPlugin(configuration)); | |
- this.middlewareStack.use(getHttpApiKeyAuthPlugin(configuration, { in: 'header', name: 'X-Api-Key'})); | |
const stack = clientStack.concat(this.middlewareStack); | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpApiKeyAuthCommand.ts ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpApiKeyAuthCommand.ts | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpApiKeyAuthCommand.ts 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpApiKeyAuthCommand.ts 2023-09-05 15:27:52 | |
@@ -4,8 +4,6 @@ | |
ServiceOutputTypes, | |
WeatherClientResolvedConfig, | |
} from "../WeatherClient"; | |
-import { getHttpApiKeyAuthPlugin } from "../middleware/HttpApiKeyAuth"; | |
-import { getSigV4AuthPlugin } from "@aws-sdk/middleware-signing"; | |
import { getSerdePlugin } from "@smithy/middleware-serde"; | |
import { | |
HttpRequest as __HttpRequest, | |
@@ -61,8 +59,6 @@ | |
options?: __HttpHandlerOptions | |
): Handler<OnlyHttpApiKeyAuthCommandInput, OnlyHttpApiKeyAuthCommandOutput> { | |
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); | |
- this.middlewareStack.use(getSigV4AuthPlugin(configuration)); | |
- this.middlewareStack.use(getHttpApiKeyAuthPlugin(configuration, { in: 'header', name: 'X-Api-Key'})); | |
const stack = clientStack.concat(this.middlewareStack); | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpBearerAuthCommand.ts ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpBearerAuthCommand.ts | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpBearerAuthCommand.ts 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/commands/OnlyHttpBearerAuthCommand.ts 2023-09-05 15:27:52 | |
@@ -4,7 +4,6 @@ | |
ServiceOutputTypes, | |
WeatherClientResolvedConfig, | |
} from "../WeatherClient"; | |
-import { getSigV4AuthPlugin } from "@aws-sdk/middleware-signing"; | |
import { getSerdePlugin } from "@smithy/middleware-serde"; | |
import { | |
HttpRequest as __HttpRequest, | |
@@ -60,7 +59,6 @@ | |
options?: __HttpHandlerOptions | |
): Handler<OnlyHttpBearerAuthCommandInput, OnlyHttpBearerAuthCommandOutput> { | |
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); | |
- this.middlewareStack.use(getSigV4AuthPlugin(configuration)); | |
const stack = clientStack.concat(this.middlewareStack); | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/commands/OnlySigv4AuthCommand.ts ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/commands/OnlySigv4AuthCommand.ts | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/commands/OnlySigv4AuthCommand.ts 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/commands/OnlySigv4AuthCommand.ts 2023-09-05 15:27:52 | |
@@ -4,7 +4,6 @@ | |
ServiceOutputTypes, | |
WeatherClientResolvedConfig, | |
} from "../WeatherClient"; | |
-import { getSigV4AuthPlugin } from "@aws-sdk/middleware-signing"; | |
import { getSerdePlugin } from "@smithy/middleware-serde"; | |
import { | |
HttpRequest as __HttpRequest, | |
@@ -60,7 +59,6 @@ | |
options?: __HttpHandlerOptions | |
): Handler<OnlySigv4AuthCommandInput, OnlySigv4AuthCommandOutput> { | |
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); | |
- this.middlewareStack.use(getSigV4AuthPlugin(configuration)); | |
const stack = clientStack.concat(this.middlewareStack); | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/commands/SameAsServiceCommand.ts ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/commands/SameAsServiceCommand.ts | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/commands/SameAsServiceCommand.ts 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/commands/SameAsServiceCommand.ts 2023-09-05 15:27:52 | |
@@ -4,7 +4,6 @@ | |
ServiceOutputTypes, | |
WeatherClientResolvedConfig, | |
} from "../WeatherClient"; | |
-import { getSigV4AuthPlugin } from "@aws-sdk/middleware-signing"; | |
import { getSerdePlugin } from "@smithy/middleware-serde"; | |
import { | |
HttpRequest as __HttpRequest, | |
@@ -60,7 +59,6 @@ | |
options?: __HttpHandlerOptions | |
): Handler<SameAsServiceCommandInput, SameAsServiceCommandOutput> { | |
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); | |
- this.middlewareStack.use(getSigV4AuthPlugin(configuration)); | |
const stack = clientStack.concat(this.middlewareStack); | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/index.ts ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/index.ts | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/index.ts 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/index.ts 2023-09-05 15:27:52 | |
@@ -5,6 +5,4 @@ | |
export * from "./commands"; | |
export * from "./models"; | |
-export * from "./middleware/HttpApiKeyAuth"; | |
- | |
export { WeatherServiceException } from "./models/WeatherServiceException"; | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/middleware/HttpApiKeyAuth/index.spec.ts ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/middleware/HttpApiKeyAuth/index.spec.ts | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/middleware/HttpApiKeyAuth/index.spec.ts 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/middleware/HttpApiKeyAuth/index.spec.ts 1969-12-31 16:00:00 | |
@@ -1,176 +0,0 @@ | |
-// smithy-typescript generated code | |
-// Please do not touch this file. It's generated from a template in: | |
-// https://github.com/awslabs/smithy-typescript/blob/main/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/aws/typescript/codegen/integration/http-api-key-auth.spec.ts | |
-import { HttpRequest } from "@smithy/protocol-http"; | |
-import { MiddlewareStack } from "@smithy/types"; | |
-import { vi } from "vitest"; | |
- | |
-import { | |
- getHttpApiKeyAuthPlugin, | |
- httpApiKeyAuthMiddleware, | |
- resolveHttpApiKeyAuthConfig, | |
-} from "./index"; | |
- | |
-describe("resolveHttpApiKeyAuthConfig", () => { | |
- it("should return the input unchanged", () => { | |
- const config = { | |
- apiKey: () => Promise.resolve("example-api-key"), | |
- }; | |
- expect(resolveHttpApiKeyAuthConfig(config)).toEqual(config); | |
- }); | |
-}); | |
- | |
-describe("getHttpApiKeyAuthPlugin", () => { | |
- it("should apply the middleware to the stack", () => { | |
- const plugin = getHttpApiKeyAuthPlugin( | |
- { | |
- apiKey: () => Promise.resolve("example-api-key"), | |
- }, | |
- { | |
- in: "query", | |
- name: "key", | |
- } | |
- ); | |
- | |
- const mockApplied = vi.fn(); | |
- const mockOther = vi.fn(); | |
- | |
- // TODO there's got to be a better way to do this mocking | |
- plugin.applyToStack({ | |
- addRelativeTo: mockApplied, | |
- // We don't expect any of these others to be called. | |
- add: mockOther, | |
- concat: mockOther, | |
- resolve: mockOther, | |
- applyToStack: mockOther, | |
- use: mockOther, | |
- clone: mockOther, | |
- remove: mockOther, | |
- removeByTag: mockOther, | |
- } as unknown as MiddlewareStack<any, any>); | |
- | |
- expect(mockApplied.mock.calls.length).toEqual(1); | |
- expect(mockOther.mock.calls.length).toEqual(0); | |
- }); | |
-}); | |
- | |
-describe("httpApiKeyAuthMiddleware", () => { | |
- describe("returned middleware function", () => { | |
- const mockNextHandler = vi.fn(); | |
- | |
- beforeEach(() => { | |
- vi.clearAllMocks(); | |
- }); | |
- | |
- it("should set the query parameter if the location is `query`", async () => { | |
- const middleware = httpApiKeyAuthMiddleware( | |
- { | |
- apiKey: () => Promise.resolve("example-api-key"), | |
- }, | |
- { | |
- in: "query", | |
- name: "key", | |
- } | |
- ); | |
- | |
- const handler = middleware(mockNextHandler, {}); | |
- | |
- await handler({ | |
- input: {}, | |
- request: new HttpRequest({}), | |
- }); | |
- | |
- expect(mockNextHandler.mock.calls.length).toEqual(1); | |
- expect( | |
- mockNextHandler.mock.calls[0][0].request.query.key | |
- ).toBe("example-api-key"); | |
- }); | |
- | |
- it("should skip if the api key has not been set", async () => { | |
- const middleware = httpApiKeyAuthMiddleware( | |
- {}, | |
- { | |
- in: "header", | |
- name: "auth", | |
- scheme: "scheme", | |
- } | |
- ); | |
- | |
- const handler = middleware(mockNextHandler, {}); | |
- | |
- await handler({ | |
- input: {}, | |
- request: new HttpRequest({}), | |
- }); | |
- | |
- expect(mockNextHandler.mock.calls.length).toEqual(1); | |
- }); | |
- | |
- it("should skip if the request is not an HttpRequest", async () => { | |
- const middleware = httpApiKeyAuthMiddleware( | |
- {}, | |
- { | |
- in: "header", | |
- name: "Authorization", | |
- } | |
- ); | |
- | |
- const handler = middleware(mockNextHandler, {}); | |
- | |
- await handler({ | |
- input: {}, | |
- request: {}, | |
- }); | |
- | |
- expect(mockNextHandler.mock.calls.length).toEqual(1); | |
- }); | |
- | |
- it("should set the API key in the lower-cased named header", async () => { | |
- const middleware = httpApiKeyAuthMiddleware( | |
- { | |
- apiKey: () => Promise.resolve("example-api-key"), | |
- }, | |
- { | |
- in: "header", | |
- name: "Authorization", | |
- } | |
- ); | |
- | |
- const handler = middleware(mockNextHandler, {}); | |
- | |
- await handler({ | |
- input: {}, | |
- request: new HttpRequest({}), | |
- }); | |
- | |
- expect(mockNextHandler.mock.calls.length).toEqual(1); | |
- expect( | |
- mockNextHandler.mock.calls[0][0].request.headers.authorization | |
- ).toBe("example-api-key"); | |
- }); | |
- | |
- it("should set the API key in the named header with the provided scheme", async () => { | |
- const middleware = httpApiKeyAuthMiddleware( | |
- { | |
- apiKey: () => Promise.resolve("example-api-key"), | |
- }, | |
- { | |
- in: "header", | |
- name: "authorization", | |
- scheme: "exampleScheme", | |
- } | |
- ); | |
- const handler = middleware(mockNextHandler, {}); | |
- | |
- await handler({ | |
- input: {}, | |
- request: new HttpRequest({}), | |
- }); | |
- | |
- expect(mockNextHandler.mock.calls.length).toEqual(1); | |
- expect( | |
- mockNextHandler.mock.calls[0][0].request.headers.authorization | |
- ).toBe("exampleScheme example-api-key"); | |
- }); | |
- }); | |
-}); | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/middleware/HttpApiKeyAuth/index.ts ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/middleware/HttpApiKeyAuth/index.ts | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/middleware/HttpApiKeyAuth/index.ts 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/middleware/HttpApiKeyAuth/index.ts 1969-12-31 16:00:00 | |
@@ -1,136 +0,0 @@ | |
-// smithy-typescript generated code | |
-// Please do not touch this file. It's generated from a template in: | |
-// https://github.com/awslabs/smithy-typescript/blob/main/smithy-typescript-codegen/src/main/resources/software/amazon/smithy/aws/typescript/codegen/integration/http-api-key-auth.ts | |
-// derived from https://github.com/aws/aws-sdk-js-v3/blob/e35f78c97fa6710ff9c444351893f0f06755e771/packages/middleware-endpoint-discovery/src/endpointDiscoveryMiddleware.ts | |
- | |
-import { HttpRequest } from "@smithy/protocol-http"; | |
-import { BuildMiddleware, Pluggable, Provider, RelativeMiddlewareOptions } from "@smithy/types"; | |
-import { normalizeProvider } from "@smithy/util-middleware"; | |
- | |
-interface HttpApiKeyAuthMiddlewareConfig { | |
- /** | |
- * Where to put the API key. | |
- * | |
- * If the value is `header`, the API key will be transported in the named header, | |
- * optionally prefixed with the provided scheme. | |
- * | |
- * If the value is `query`, the API key will be transported in the named query parameter. | |
- */ | |
- in: "header" | "query"; | |
- | |
- /** | |
- * The name of the header / query parameter to use for the transporting the API key. | |
- */ | |
- name: string; | |
- | |
- /** | |
- * The scheme to use. Only supported when `in` is `header`. | |
- */ | |
- scheme?: string; | |
-} | |
- | |
-export interface HttpApiKeyAuthInputConfig { | |
- /** | |
- * The API key to use when making requests. | |
- * | |
- * This is optional because some operations may not require an API key. | |
- */ | |
- apiKey?: string | Provider<string>; | |
-} | |
- | |
-export interface ApiKeyPreviouslyResolved {} | |
- | |
-export interface HttpApiKeyAuthResolvedConfig { | |
- /** | |
- * The API key to use when making requests. | |
- * | |
- * This is optional because some operations may not require an API key. | |
- */ | |
- apiKey?: Provider<string>; | |
-} | |
- | |
-// We have to provide a resolve function when we have config, even if it doesn't | |
-// actually do anything to the input value. "If any of inputConfig, resolvedConfig, | |
-// or resolveFunction are set, then all of inputConfig, resolvedConfig, and | |
-// resolveFunction must be set." | |
-export function resolveHttpApiKeyAuthConfig<T>( | |
- input: T & ApiKeyPreviouslyResolved & HttpApiKeyAuthInputConfig, | |
-): T & HttpApiKeyAuthResolvedConfig { | |
- return { | |
- ...input, | |
- apiKey: input.apiKey ? normalizeProvider(input.apiKey) : undefined, | |
- }; | |
-} | |
- | |
-/** | |
- * Middleware to inject the API key into the HTTP request. | |
- * | |
- * The middleware will inject the client's configured API key into the | |
- * request as defined by the `@httpApiKeyAuth` trait. If the trait says to | |
- * put the API key into a named header, that header will be used, optionally | |
- * prefixed with a scheme. If the trait says to put the API key into a named | |
- * query parameter, that query parameter will be used. | |
- * | |
- * @param pluginConfig the client configuration. Includes the function that will return the API key value. | |
- * @param middlewareConfig the plugin options (location of the parameter, name, and optional scheme) | |
- * @returns a function that processes the HTTP request and passes it on to the next handler | |
- */ | |
-export const httpApiKeyAuthMiddleware = | |
- <Input extends object, Output extends object>( | |
- pluginConfig: HttpApiKeyAuthResolvedConfig, | |
- middlewareConfig: HttpApiKeyAuthMiddlewareConfig, | |
- ): BuildMiddleware<Input, Output> => | |
- (next) => | |
- async (args) => { | |
- if (!HttpRequest.isInstance(args.request)) return next(args); | |
- | |
- const apiKey = pluginConfig.apiKey && (await pluginConfig.apiKey()); | |
- | |
- // This middleware will not be injected if the operation has the @optionalAuth trait. | |
- // We don't know if we're the only auth middleware, so let the service deal with the | |
- // absence of the API key (or let other middleware do its job). | |
- if (!apiKey) { | |
- return next(args); | |
- } | |
- | |
- return next({ | |
- ...args, | |
- request: { | |
- ...args.request, | |
- headers: { | |
- ...args.request.headers, | |
- ...(middlewareConfig.in === "header" && { | |
- // Set the header, even if it's already been set. | |
- [middlewareConfig.name.toLowerCase()]: middlewareConfig.scheme | |
- ? `${middlewareConfig.scheme} ${apiKey}` | |
- : apiKey, | |
- }), | |
- }, | |
- query: { | |
- ...args.request.query, | |
- // Set the query parameter, even if it's already been set. | |
- ...(middlewareConfig.in === "query" && { [middlewareConfig.name]: apiKey }), | |
- }, | |
- }, | |
- }); | |
- }; | |
- | |
-export const httpApiKeyAuthMiddlewareOptions: RelativeMiddlewareOptions = { | |
- name: "httpApiKeyAuthMiddleware", | |
- tags: ["APIKEY", "AUTH"], | |
- relation: "after", | |
- toMiddleware: "retryMiddleware", | |
- override: true, | |
-}; | |
- | |
-export const getHttpApiKeyAuthPlugin = ( | |
- pluginConfig: HttpApiKeyAuthResolvedConfig, | |
- middlewareConfig: HttpApiKeyAuthMiddlewareConfig, | |
-): Pluggable<any, any> => ({ | |
- applyToStack: (clientStack) => { | |
- clientStack.addRelativeTo( | |
- httpApiKeyAuthMiddleware(pluginConfig, middlewareConfig), | |
- httpApiKeyAuthMiddlewareOptions, | |
- ); | |
- }, | |
-}); | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/runtimeConfig.browser.ts ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/runtimeConfig.browser.ts | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/runtimeConfig.browser.ts 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/runtimeConfig.browser.ts 2023-09-05 15:27:52 | |
@@ -5,10 +5,16 @@ | |
import { Sha256 } from "@aws-crypto/sha256-browser"; | |
import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; | |
import { | |
+ HttpApiKeyAuthSigner, | |
+ HttpBearerAuthSigner, | |
+ IdentityProviderConfig, | |
+ NoAuthSigner, | |
+ SigV4Signer, | |
+} from "@smithy/experimental-identity-and-auth"; | |
+import { | |
FetchHttpHandler as RequestHandler, | |
streamCollector, | |
} from "@smithy/fetch-http-handler"; | |
-import { invalidProvider } from "@smithy/invalid-dependency"; | |
import { calculateBodyLength } from "@smithy/util-body-length-browser"; | |
import { | |
DEFAULT_MAX_ATTEMPTS, | |
@@ -32,10 +38,29 @@ | |
runtime: "browser", | |
defaultsMode, | |
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, | |
- credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))), | |
defaultUserAgentProvider: config?.defaultUserAgentProvider ?? defaultUserAgent({clientVersion: packageInfo.version}), | |
+ httpAuthSchemes: config?.httpAuthSchemes ?? [{ | |
+ schemeId: "aws.auth#sigv4", | |
+ identityProvider: (config: IdentityProviderConfig) => | |
+ config.getIdentityProvider("aws.auth#sigv4"), | |
+ signer: new SigV4Signer(), | |
+ }, { | |
+ schemeId: "smithy.api#httpApiKeyAuth", | |
+ identityProvider: (config: IdentityProviderConfig) => | |
+ config.getIdentityProvider("smithy.api#httpApiKeyAuth"), | |
+ signer: new HttpApiKeyAuthSigner(), | |
+ }, { | |
+ schemeId: "smithy.api#httpBearerAuth", | |
+ identityProvider: (config: IdentityProviderConfig) => | |
+ config.getIdentityProvider("smithy.api#httpBearerAuth") || (async () => { throw new Error("`token` is missing"); }), | |
+ signer: new HttpBearerAuthSigner(), | |
+ }, { | |
+ schemeId: "smithy.api#noAuth", | |
+ identityProvider: (config: IdentityProviderConfig) => | |
+ config.getIdentityProvider("smithy.api#noAuth") || (async () => ({})), | |
+ signer: new NoAuthSigner(), | |
+ }], | |
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS, | |
- region: config?.region ?? invalidProvider("Region is missing"), | |
requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), | |
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), | |
sha256: config?.sha256 ?? Sha256, | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/runtimeConfig.shared.ts ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/runtimeConfig.shared.ts | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/runtimeConfig.shared.ts 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/runtimeConfig.shared.ts 2023-09-05 15:27:52 | |
@@ -1,4 +1,12 @@ | |
// smithy-typescript generated code | |
+import { defaultWeatherHttpAuthSchemeProvider } from "./auth/httpAuthSchemeProvider"; | |
+import { | |
+ HttpApiKeyAuthSigner, | |
+ HttpBearerAuthSigner, | |
+ IdentityProviderConfig, | |
+ NoAuthSigner, | |
+ SigV4Signer, | |
+} from "@smithy/experimental-identity-and-auth"; | |
import { NoOpLogger } from "@smithy/smithy-client"; | |
import { parseUrl } from "@smithy/url-parser"; | |
import { | |
@@ -20,8 +28,29 @@ | |
base64Encoder: config?.base64Encoder ?? toBase64, | |
disableHostPrefix: config?.disableHostPrefix ?? false, | |
extensions: config?.extensions ?? [], | |
+ httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultWeatherHttpAuthSchemeProvider, | |
+ httpAuthSchemes: config?.httpAuthSchemes ?? [{ | |
+ schemeId: "aws.auth#sigv4", | |
+ identityProvider: (config: IdentityProviderConfig) => | |
+ config.getIdentityProvider("aws.auth#sigv4"), | |
+ signer: new SigV4Signer(), | |
+ }, { | |
+ schemeId: "smithy.api#httpApiKeyAuth", | |
+ identityProvider: (config: IdentityProviderConfig) => | |
+ config.getIdentityProvider("smithy.api#httpApiKeyAuth"), | |
+ signer: new HttpApiKeyAuthSigner(), | |
+ }, { | |
+ schemeId: "smithy.api#httpBearerAuth", | |
+ identityProvider: (config: IdentityProviderConfig) => | |
+ config.getIdentityProvider("smithy.api#httpBearerAuth"), | |
+ signer: new HttpBearerAuthSigner(), | |
+ }, { | |
+ schemeId: "smithy.api#noAuth", | |
+ identityProvider: (config: IdentityProviderConfig) => | |
+ config.getIdentityProvider("smithy.api#noAuth") || (async () => ({})), | |
+ signer: new NoAuthSigner(), | |
+ }], | |
logger: config?.logger ?? new NoOpLogger(), | |
- signingName: config?.signingName ?? "weather", | |
urlParser: config?.urlParser ?? parseUrl, | |
utf8Decoder: config?.utf8Decoder ?? fromUtf8, | |
utf8Encoder: config?.utf8Encoder ?? toUtf8, | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/runtimeConfig.ts ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/runtimeConfig.ts | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/src/runtimeConfig.ts 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/src/runtimeConfig.ts 2023-09-05 15:27:52 | |
@@ -2,13 +2,15 @@ | |
// @ts-ignore: package.json will be imported from dist folders | |
import packageInfo from "../package.json"; // eslint-disable-line | |
-import { decorateDefaultCredentialProvider } from "@aws-sdk/client-sts"; | |
-import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node"; | |
+import { nodeProvider } from "@aws-sdk/token-providers"; | |
import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; | |
import { | |
- NODE_REGION_CONFIG_FILE_OPTIONS, | |
- NODE_REGION_CONFIG_OPTIONS, | |
-} from "@smithy/config-resolver"; | |
+ HttpApiKeyAuthSigner, | |
+ HttpBearerAuthSigner, | |
+ IdentityProviderConfig, | |
+ NoAuthSigner, | |
+ SigV4Signer, | |
+} from "@smithy/experimental-identity-and-auth"; | |
import { Hash } from "@smithy/hash-node"; | |
import { | |
NODE_MAX_ATTEMPT_CONFIG_OPTIONS, | |
@@ -41,10 +43,29 @@ | |
runtime: "node", | |
defaultsMode, | |
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength, | |
- credentialDefaultProvider: config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider), | |
defaultUserAgentProvider: config?.defaultUserAgentProvider ?? defaultUserAgent({clientVersion: packageInfo.version}), | |
+ httpAuthSchemes: config?.httpAuthSchemes ?? [{ | |
+ schemeId: "aws.auth#sigv4", | |
+ identityProvider: (config: IdentityProviderConfig) => | |
+ config.getIdentityProvider("aws.auth#sigv4"), | |
+ signer: new SigV4Signer(), | |
+ }, { | |
+ schemeId: "smithy.api#httpApiKeyAuth", | |
+ identityProvider: (config: IdentityProviderConfig) => | |
+ config.getIdentityProvider("smithy.api#httpApiKeyAuth"), | |
+ signer: new HttpApiKeyAuthSigner(), | |
+ }, { | |
+ schemeId: "smithy.api#httpBearerAuth", | |
+ identityProvider: (config: IdentityProviderConfig) => | |
+ config.getIdentityProvider("smithy.api#httpBearerAuth") || (nodeProvider), | |
+ signer: new HttpBearerAuthSigner(), | |
+ }, { | |
+ schemeId: "smithy.api#noAuth", | |
+ identityProvider: (config: IdentityProviderConfig) => | |
+ config.getIdentityProvider("smithy.api#noAuth") || (async () => ({})), | |
+ signer: new NoAuthSigner(), | |
+ }], | |
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS), | |
- region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS), | |
requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), | |
retryMode: config?.retryMode ?? loadNodeConfig({...NODE_RETRY_MODE_CONFIG_OPTIONS,default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,}), | |
sha256: config?.sha256 ?? Hash.bind(null, "sha256"), | |
diff --color -Nur ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/vite.config.js ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/vite.config.js | |
--- ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/control-experimental-identity-and-auth/typescript-codegen/vite.config.js 2023-09-05 15:27:52 | |
+++ ./generic-client-test-codegen/build/smithyprojections/generic-client-test-codegen/client-experimental-identity-and-auth/typescript-codegen/vite.config.js 1969-12-31 16:00:00 | |
@@ -1,8 +0,0 @@ | |
-import { defineConfig } from 'vite' | |
- | |
-export default defineConfig({ | |
- test: { | |
- include: ['**/*.spec.ts'], | |
- globals: true | |
- }, | |
-}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment