Skip to content

Commit e5b8295

Browse files
Steven Yuankuhe
authored andcommitted
feat(experimentalIdentityAndAuth): enable identity and auth by default
1 parent de8d4a6 commit e5b8295

File tree

16 files changed

+50
-75
lines changed

16 files changed

+50
-75
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ experimental features that can affect `aws-sdk-js-v3`. These features are enable
149149
Note that any contributions related to these features MUST be reviewed carefully for opt-in behavior via feature flags
150150
as to not break any existing customers. Here are the experimental features that are currently under development:
151151

152-
| Experimental Feature | Flag | Description |
153-
| -------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
154-
| Identity & Auth | `experimentalIdentityAndAuth` | Standardize identity and auth integrations to match the Smithy specification (see [Authentication Traits](https://smithy.io/2.0/spec/authentication-traits.html)). Newer capabilities include support for multiple auth schemes, `@optionalAuth`, and standardized identity interfaces for authentication schemes both in code generation and TypeScript packages. In `smithy-typescript`, `@httpApiKeyAuth` will be updated to use the new standardized interfaces. In `aws-sdk-js-v3` (`smithy-typescript`'s largest customer), this will affect `@aws.auth#sigv4` and `@httpBearerAuth` implementations, but is planned to be completely backwards-compatible. |
152+
| Experimental Feature | Flag | Description |
153+
| -------------------- | ---- | ----------- |
154+
| N/A | N/A | N/A |
155155

156156
## Build caching
157157

codegen/generic-client-test-codegen/model/weather.smithy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ structure fakeProtocol {}
2121
service Weather {
2222
version: "2006-03-01"
2323
operations: [
24-
// experimentalIdentityAndAuth
24+
// Identity and Auth
2525
OnlyHttpApiKeyAuth
2626
OnlyHttpApiKeyAuthOptional
2727
OnlyHttpBearerAuth

codegen/generic-client-test-codegen/smithy-build.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"version": "1.0",
33
"imports": ["model/echo.smithy"],
44
"projections": {
5-
"client-experimental-identity-and-auth": {
5+
"client-identity-and-auth": {
66
"transforms": [
77
{
88
"name": "includeServices",
@@ -13,7 +13,7 @@
1313
],
1414
"plugins": {
1515
"typescript-codegen": {
16-
"package": "@aws-sdk/weather-experimental-identity-and-auth",
16+
"package": "@aws-sdk/weather",
1717
"packageVersion": "0.0.1",
1818
"packageJson": {
1919
"author": {
@@ -22,12 +22,11 @@
2222
},
2323
"license": "Apache-2.0"
2424
},
25-
"private": true,
26-
"experimentalIdentityAndAuth": true
25+
"private": true
2726
}
2827
}
2928
},
30-
"control-experimental-identity-and-auth": {
29+
"client-legacy-auth": {
3130
"transforms": [
3231
{
3332
"name": "includeServices",
@@ -38,7 +37,7 @@
3837
],
3938
"plugins": {
4039
"typescript-codegen": {
41-
"package": "@aws-sdk/weather",
40+
"package": "@aws-sdk/weather-legacy-auth",
4241
"packageVersion": "0.0.1",
4342
"packageJson": {
4443
"author": {
@@ -47,7 +46,8 @@
4746
},
4847
"license": "Apache-2.0"
4948
},
50-
"private": true
49+
"private": true,
50+
"useLegacyAuth": true
5151
}
5252
}
5353
},

codegen/protocol-test-codegen/smithy-build.json

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
},
2222
"license": "Apache-2.0"
2323
},
24-
"private": true,
25-
"experimentalIdentityAndAuth": true
24+
"private": true
2625
}
2726
}
2827
},
@@ -46,8 +45,7 @@
4645
},
4746
"license": "Apache-2.0"
4847
},
49-
"private": true,
50-
"experimentalIdentityAndAuth": true
48+
"private": true
5149
}
5250
}
5351
},
@@ -71,8 +69,7 @@
7169
},
7270
"license": "Apache-2.0"
7371
},
74-
"private": true,
75-
"experimentalIdentityAndAuth": true
72+
"private": true
7673
}
7774
}
7875
},
@@ -96,8 +93,7 @@
9693
},
9794
"license": "Apache-2.0"
9895
},
99-
"private": true,
100-
"experimentalIdentityAndAuth": true
96+
"private": true
10197
}
10298
}
10399
},
@@ -121,8 +117,7 @@
121117
},
122118
"license": "Apache-2.0"
123119
},
124-
"private": true,
125-
"experimentalIdentityAndAuth": true
120+
"private": true
126121
}
127122
}
128123
},
@@ -146,8 +141,7 @@
146141
},
147142
"license": "Apache-2.0"
148143
},
149-
"private": true,
150-
"experimentalIdentityAndAuth": true
144+
"private": true
151145
},
152146
"typescript-ssdk-codegen": {
153147
"package": "@aws-sdk/aws-restjson-server",
@@ -177,8 +171,7 @@
177171
},
178172
"license": "Apache-2.0"
179173
},
180-
"private": true,
181-
"experimentalIdentityAndAuth": true
174+
"private": true
182175
}
183176
}
184177
},
@@ -202,8 +195,7 @@
202195
},
203196
"license": "Apache-2.0"
204197
},
205-
"private": true,
206-
"experimentalIdentityAndAuth": true
198+
"private": true
207199
}
208200
}
209201
},
@@ -244,8 +236,7 @@
244236
},
245237
"license": "Apache-2.0"
246238
},
247-
"private": true,
248-
"experimentalIdentityAndAuth": true
239+
"private": true
249240
}
250241
}
251242
}

codegen/sdk-codegen/build.gradle.kts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,6 @@ tasks.register("generate-smithy-build") {
106106
File("smithy-aws-typescript-codegen/src/main/resources/software/amazon/smithy/aws/typescript/codegen/package.json.template")
107107
.readText()
108108
).expectObjectNode()
109-
val nonExperimentalIdentityAndAuthServices = setOf(
110-
// Services with EventStream input
111-
"Lex Runtime V2",
112-
"RekognitionStreaming",
113-
"Transcribe Streaming",
114-
// Endpoint Ruleset Auth Scheme Resolvers
115-
"EventBridge",
116-
"CloudFront KeyValueStore",
117-
// S3
118-
"S3",
119-
)
120-
check(nonExperimentalIdentityAndAuthServices.size == 6)
121109
val projectionContents = Node.objectNodeBuilder()
122110
.withMember("imports", Node.fromStrings("${models.getAbsolutePath()}${File.separator}${file.name}"))
123111
.withMember("plugins", Node.objectNode()
@@ -128,7 +116,6 @@ tasks.register("generate-smithy-build") {
128116
.withMember("packageJson", manifestOverwrites)
129117
.withMember("packageDescription", "AWS SDK for JavaScript "
130118
+ clientName + " Client for Node.js, Browser and React Native")
131-
.withMember("experimentalIdentityAndAuth", !nonExperimentalIdentityAndAuthServices.contains(serviceTrait.sdkId))
132119
.build()))
133120
.build()
134121
projectionsBuilder.withMember(sdkId + "." + version.toLowerCase(), projectionContents)

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddAwsAuthPlugin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
/**
5757
* Configure clients with AWS auth configurations and plugin.
5858
*
59-
* This is the existing control behavior for `experimentalIdentityAndAuth`.
59+
* This is legacy auth behavior, and is no longer supported in development.
6060
*/
6161
@SmithyInternalApi
6262
public final class AddAwsAuthPlugin implements TypeScriptIntegration {
@@ -68,11 +68,11 @@ public final class AddAwsAuthPlugin implements TypeScriptIntegration {
6868
private static final Logger LOGGER = Logger.getLogger(AddAwsAuthPlugin.class.getName());
6969

7070
/**
71-
* Integration should only be used if `experimentalIdentityAndAuth` flag is false.
71+
* Integration should only be used if the `useLegacyAuth` flag is true.
7272
*/
7373
@Override
7474
public boolean matchesSettings(TypeScriptSettings settings) {
75-
return !settings.getExperimentalIdentityAndAuth();
75+
return settings.useLegacyAuth();
7676
}
7777

7878
@Override

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddSigv4aPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public final class AddSigv4aPlugin implements TypeScriptIntegration {
2727

2828
@Override
2929
public boolean matchesSettings(TypeScriptSettings settings) {
30-
return !settings.getExperimentalIdentityAndAuth();
30+
return !!settings.useLegacyAuth();
3131
}
3232

3333
public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddTokenAuthPlugin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@
2929
/**
3030
* Configure clients with Token auth configurations and plugin.
3131
*
32-
* This is the existing control behavior for `experimentalIdentityAndAuth`.
32+
* This is legacy auth behavior, and is no longer supported in development.
3333
*/
3434
@SmithyInternalApi
3535
public final class AddTokenAuthPlugin implements TypeScriptIntegration {
3636

3737
/**
38-
* Integration should only be used if `experimentalIdentityAndAuth` flag is false.
38+
* Integration should only be used if the `useLegacyAuth` flag is true.
3939
*/
4040
@Override
4141
public boolean matchesSettings(TypeScriptSettings settings) {
42-
return !settings.getExperimentalIdentityAndAuth();
42+
return settings.useLegacyAuth();
4343
}
4444

4545
@Override

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsDependency.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public enum AwsDependency implements Dependency {
9191
// Conditionally added when EndpointRuleSetTrait is present
9292
UTIL_ENDPOINTS(NORMAL_DEPENDENCY, "@aws-sdk/util-endpoints"),
9393

94-
// feat(experimentalIdentityAndAuth): Conditionally added when @httpBearerAuth is used in an AWS service
94+
// Conditionally added when @httpBearerAuth is used in an AWS service
9595
TOKEN_PROVIDERS(NORMAL_DEPENDENCY, "@aws-sdk/token-providers"),
9696
TYPES(NORMAL_DEPENDENCY, "@aws-sdk/types"),
9797
REGION_CONFIG_RESOLVER(NORMAL_DEPENDENCY, "@aws-sdk/region-config-resolver"),

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/auth/http/integration/AddAwsDefaultSigningName.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,17 @@
2121

2222
/**
2323
* Configure clients with Default AWS Signing Name.
24-
*
25-
* This is the experimental behavior for `experimentalIdentityAndAuth`.
2624
*/
2725
@SmithyInternalApi
2826
public final class AddAwsDefaultSigningName implements TypeScriptIntegration {
2927
private static final Logger LOGGER = Logger.getLogger(AddAwsDefaultSigningName.class.getName());
3028

3129
/**
32-
* Integration should only be used if `experimentalIdentityAndAuth` flag is true.
30+
* Integration should be skipped if the `useLegacyAuth` flag is true.
3331
*/
3432
@Override
3533
public boolean matchesSettings(TypeScriptSettings settings) {
36-
return settings.getExperimentalIdentityAndAuth();
34+
return !settings.useLegacyAuth();
3735
}
3836

3937
@Override

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/auth/http/integration/AddSTSAuthCustomizations.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242

4343
/**
4444
* Add STS Auth customizations.
45-
*
46-
* This is the experimental behavior for `experimentalIdentityAndAuth`.
4745
*/
4846
@SmithyInternalApi
4947
@SuppressWarnings("AbbreviationAsWordInName")
@@ -66,11 +64,11 @@ public final class AddSTSAuthCustomizations implements HttpAuthTypeScriptIntegra
6664
private static final String ROLE_ASSUMERS_TEST_FILE = "defaultRoleAssumers.spec";
6765

6866
/**
69-
* Integration should only be used if `experimentalIdentityAndAuth` flag is true.
67+
* Integration should be skipped if the `useLegacyAuth` flag is true.
7068
*/
7169
@Override
7270
public boolean matchesSettings(TypeScriptSettings settings) {
73-
return settings.getExperimentalIdentityAndAuth() && isSTSService(settings.getService());
71+
return !settings.useLegacyAuth() && isSTSService(settings.getService());
7472
}
7573

7674
@Override

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/auth/http/integration/AwsSdkCustomizeEndpointRuleSetHttpAuthSchemeProvider.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import software.amazon.smithy.typescript.codegen.auth.http.sections.HttpAuthSchemeParametersInterfaceCodeSection;
3737
import software.amazon.smithy.typescript.codegen.auth.http.sections.HttpAuthSchemeProviderInterfaceCodeSection;
3838
import software.amazon.smithy.typescript.codegen.endpointsV2.EndpointsV2Generator;
39+
import software.amazon.smithy.typescript.codegen.sections.PreCommandClassCodeSection;
3940
import software.amazon.smithy.typescript.codegen.sections.SmithyContextCodeSection;
4041
import software.amazon.smithy.utils.CodeInterceptor;
4142
import software.amazon.smithy.utils.CodeSection;
@@ -46,22 +47,21 @@
4647
*
4748
* This code generates `HttpAuthSchemeProvider` interfaces based on {@code @smithy.rules#endpointRuleSet} for
4849
* identity and auth purposes only.
49-
*
50-
* This is the experimental behavior for `experimentalIdentityAndAuth`.
5150
*/
5251
@SmithyInternalApi
5352
public final class AwsSdkCustomizeEndpointRuleSetHttpAuthSchemeProvider implements HttpAuthTypeScriptIntegration {
5453
private static final Set<ShapeId> ENDPOINT_RULESET_HTTP_AUTH_SCHEME_SERVICES = Set.of(
5554
ShapeId.from("com.amazonaws.s3#AmazonS3"),
56-
ShapeId.from("com.amazonaws.eventbridge#AWSEvents"));
55+
ShapeId.from("com.amazonaws.eventbridge#AWSEvents"),
56+
ShapeId.from("com.amazonaws.cloudfrontkeyvaluestore#CloudFrontKeyValueStore"));
5757
private static final ShapeId SIGV4A_ID = ShapeId.from("aws.auth#sigv4a");
5858

5959
/**
60-
* Integration should only be used if `experimentalIdentityAndAuth` flag is true.
60+
* Integration should be skipped if the `useLegacyAuth` flag is true.
6161
*/
6262
@Override
6363
public boolean matchesSettings(TypeScriptSettings settings) {
64-
return settings.getExperimentalIdentityAndAuth()
64+
return !settings.useLegacyAuth()
6565
&& ENDPOINT_RULESET_HTTP_AUTH_SCHEME_SERVICES.contains(settings.getService());
6666
}
6767

@@ -99,9 +99,13 @@ public List<? extends CodeInterceptor<? extends CodeSection, TypeScriptWriter>>
9999
TypeScriptCodegenContext codegenContext
100100
) {
101101
return List.of(
102+
CodeInterceptor.appender(PreCommandClassCodeSection.class, (w, s) -> {
103+
w.write("// @ts-expect-error: Command class references itself");
104+
}),
102105
CodeInterceptor.appender(SmithyContextCodeSection.class, (w, s) -> {
103106
if (s.getService().hasTrait(EndpointRuleSetTrait.ID)) {
104107
w.openBlock("endpointRuleSet: {", "},", () -> {
108+
w.write("// @ts-expect-error: built class has getEndpointParameterInstructions()");
105109
w.write("getEndpointParameterInstructions: $T.getEndpointParameterInstructions,",
106110
codegenContext.symbolProvider().toSymbol(s.getOperation()));
107111
});

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/auth/http/integration/AwsSdkCustomizeHttpBearerTokenAuth.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,16 @@
2323

2424
/**
2525
* Customize @httpBearerAuth for AWS SDKs.
26-
*
27-
* This is the experimental behavior for `experimentalIdentityAndAuth`.
2826
*/
2927
@SmithyInternalApi
3028
public final class AwsSdkCustomizeHttpBearerTokenAuth implements HttpAuthTypeScriptIntegration {
3129

3230
/**
33-
* Integration should only be used if `experimentalIdentityAndAuth` flag is true.
31+
* Integration should be skipped if the `useLegacyAuth` flag is true.
3432
*/
3533
@Override
3634
public boolean matchesSettings(TypeScriptSettings settings) {
37-
return settings.getExperimentalIdentityAndAuth();
35+
return !settings.useLegacyAuth();
3836
}
3937

4038
@Override

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/auth/http/integration/AwsSdkCustomizeSigV4Auth.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,16 @@
3636

3737
/**
3838
* Customize @aws.auth#sigv4 for AWS SDKs.
39-
*
40-
* This is the experimental behavior for `experimentalIdentityAndAuth`.
4139
*/
4240
@SmithyInternalApi
4341
public class AwsSdkCustomizeSigV4Auth implements HttpAuthTypeScriptIntegration {
4442

4543
/**
46-
* Integration should only be used if `experimentalIdentityAndAuth` flag is true.
44+
* Integration should be skipped if the `useLegacyAuth` flag is true.
4745
*/
4846
@Override
4947
public boolean matchesSettings(TypeScriptSettings settings) {
50-
return settings.getExperimentalIdentityAndAuth();
48+
return !settings.useLegacyAuth();
5149
}
5250

5351
@Override

0 commit comments

Comments
 (0)