Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(experimentalIdentityAndAuth): make experimentalIdentityAndAuth default #5298

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ experimental features that can affect `aws-sdk-js-v3`. These features are enable
Note that any contributions related to these features MUST be reviewed carefully for opt-in behavior via feature flags
as to not break any existing customers. Here are the experimental features that are currently under development:

| Experimental Feature | Flag | Description |
| -------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 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. |
| Experimental Feature | Flag | Description |
| -------------------- | ---- | ----------- |
| Currently None | N/A | N/A |

## Build caching

Expand Down
2 changes: 1 addition & 1 deletion codegen/generic-client-test-codegen/model/weather.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ structure fakeProtocol {}
service Weather {
version: "2006-03-01"
operations: [
// experimentalIdentityAndAuth
// Identity and Auth
OnlyHttpApiKeyAuth
OnlyHttpApiKeyAuthOptional
OnlyHttpBearerAuth
Expand Down
27 changes: 1 addition & 26 deletions codegen/generic-client-test-codegen/smithy-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,7 @@
"version": "1.0",
"imports": ["model/echo.smithy"],
"projections": {
"client-experimental-identity-and-auth": {
"transforms": [
{
"name": "includeServices",
"args": {
"services": ["example.weather#Weather"]
}
}
],
"plugins": {
"typescript-codegen": {
"package": "@aws-sdk/weather-experimental-identity-and-auth",
"packageVersion": "0.0.1",
"packageJson": {
"author": {
"name": "AWS SDK for JavaScript Team",
"url": "https://aws.amazon.com/javascript/"
},
"license": "Apache-2.0"
},
"private": true,
"experimentalIdentityAndAuth": true
}
}
},
"control-experimental-identity-and-auth": {
"control-identity-and-auth": {
"transforms": [
{
"name": "includeServices",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@

/**
* Configure clients with AWS auth configurations and plugin.
*
* This is the existing control behavior for `experimentalIdentityAndAuth`.
*/
@Deprecated
@SmithyInternalApi
public final class AddAwsAuthPlugin implements TypeScriptIntegration {
static final String STS_CLIENT_PREFIX = "sts-client-";
Expand All @@ -67,14 +66,6 @@ public final class AddAwsAuthPlugin implements TypeScriptIntegration {

private static final Logger LOGGER = Logger.getLogger(AddAwsAuthPlugin.class.getName());

/**
* Integration should only be used if `experimentalIdentityAndAuth` flag is false.
*/
@Override
public boolean matchesSettings(TypeScriptSettings settings) {
return !settings.getExperimentalIdentityAndAuth();
}

@Override
public void addConfigInterfaceFields(
TypeScriptSettings settings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,17 @@
import static software.amazon.smithy.typescript.codegen.integration.RuntimeClientPlugin.Convention.HAS_MIDDLEWARE;

import java.util.List;
import software.amazon.smithy.typescript.codegen.TypeScriptSettings;
import software.amazon.smithy.typescript.codegen.integration.RuntimeClientPlugin;
import software.amazon.smithy.typescript.codegen.integration.TypeScriptIntegration;
import software.amazon.smithy.utils.ListUtils;
import software.amazon.smithy.utils.SmithyInternalApi;

/**
* Configure clients with Token auth configurations and plugin.
*
* This is the existing control behavior for `experimentalIdentityAndAuth`.
*/
@Deprecated
@SmithyInternalApi
public final class AddTokenAuthPlugin implements TypeScriptIntegration {

/**
* Integration should only be used if `experimentalIdentityAndAuth` flag is false.
*/
@Override
public boolean matchesSettings(TypeScriptSettings settings) {
return !settings.getExperimentalIdentityAndAuth();
}

@Override
public List<RuntimeClientPlugin> getClientPlugins() {
return ListUtils.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public enum AwsDependency implements Dependency {
// Conditionally added when EndpointRuleSetTrait is present
UTIL_ENDPOINTS(NORMAL_DEPENDENCY, "@aws-sdk/util-endpoints"),

// feat(experimentalIdentityAndAuth): Conditionally added when @httpBearerAuth is used in an AWS service
// Conditionally added when @httpBearerAuth is used in an AWS service
TOKEN_PROVIDERS(NORMAL_DEPENDENCY, "@aws-sdk/token-providers"),
TYPES(NORMAL_DEPENDENCY, "@aws-sdk/types"),
REGION_CONFIG_RESOLVER(NORMAL_DEPENDENCY, "@aws-sdk/region-config-resolver");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
software.amazon.smithy.aws.typescript.codegen.AddEndpointsV2ParameterNameMap
software.amazon.smithy.aws.typescript.codegen.AddAwsRuntimeConfig
software.amazon.smithy.aws.typescript.codegen.AddBuiltinPlugins
software.amazon.smithy.aws.typescript.codegen.AddAwsAuthPlugin
software.amazon.smithy.aws.typescript.codegen.AddTokenAuthPlugin
software.amazon.smithy.aws.typescript.codegen.AddProtocols
software.amazon.smithy.aws.typescript.codegen.AwsEndpointGeneratorIntegration
software.amazon.smithy.aws.typescript.codegen.AddNimbleCustomizations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.not;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import software.amazon.smithy.build.MockManifest;
import software.amazon.smithy.build.PluginContext;
Expand All @@ -12,7 +13,9 @@
import software.amazon.smithy.typescript.codegen.CodegenUtils;
import software.amazon.smithy.typescript.codegen.TypeScriptCodegenPlugin;

@Deprecated
public class AddAwsAuthPluginTest {
@Disabled("software.amazon.smithy.aws.typescript.codegen.AddAwsAuthPlugin is considered deprecated")
@Test
public void awsClient() {
Model model = Model.assembler()
Expand Down Expand Up @@ -52,6 +55,7 @@ public void awsClient() {
assertThat(manifest.getFileString(CodegenUtils.SOURCE_FOLDER + "/NotSameClient.ts").get(), containsString("getAwsAuthPlugin"));
}

@Disabled("software.amazon.smithy.aws.typescript.codegen.AddAwsAuthPlugin is considered deprecated")
@Test
public void sigV4GenericClient() {
Model model = Model.assembler()
Expand Down