Skip to content

Commit

Permalink
chore(client-sso-oidc): move sts to peer (#6224)
Browse files Browse the repository at this point in the history
  • Loading branch information
isaiahshall authored Jun 26, 2024
1 parent 80c133b commit 1cc4de9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion clients/client-sso-oidc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"dependencies": {
"@aws-crypto/sha256-browser": "5.2.0",
"@aws-crypto/sha256-js": "5.2.0",
"@aws-sdk/client-sts": "*",
"@aws-sdk/core": "*",
"@aws-sdk/credential-provider-node": "*",
"@aws-sdk/middleware-host-header": "*",
Expand Down Expand Up @@ -59,6 +58,9 @@
"@smithy/util-utf8": "^3.0.0",
"tslib": "^2.6.2"
},
"peerDependencies": {
"@aws-sdk/client-sts": "*"
},
"devDependencies": {
"@tsconfig/node16": "16.1.3",
"@types/node": "^16.18.96",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,21 @@ private AwsCredentialProviderUtils() {}
* The dependencies are skipped in first party credential providers to avoid circular dependency issue.
*/
public static void addAwsCredentialProviderDependencies(ServiceShape service, TypeScriptWriter writer) {
if (!service.getId().equals(ShapeId.from("com.amazonaws.ssooidc#AWSSSOOIDCService"))) {
boolean isStsClient =
service.getId().equals(ShapeId.from("com.amazonaws.sts#AWSSecurityTokenServiceV20110615"));
boolean isSsoOidcClient = service.getId().equals(ShapeId.from("com.amazonaws.ssooidc#AWSSSOOIDCService"));
if (!isSsoOidcClient) {
// SSO OIDC client is required in Sso credential provider
writer.addDependency(AwsDependency.SSO_OIDC_CLIENT);
}
if (!service.getId().equals(ShapeId.from("com.amazonaws.sts#AWSSecurityTokenServiceV20110615"))) {
if (!isStsClient) {
// STS client is required in Ini and WebIdentity credential providers
writer.addDependency(AwsDependency.STS_CLIENT);
if (isSsoOidcClient) {
// For the SSO OIDC client, adding the STS client as a peerDependency avoids circular dependency issues.
writer.addDependency(AwsDependency.STS_CLIENT_PEER);
} else {
writer.addDependency(AwsDependency.STS_CLIENT);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public enum AwsDependency implements Dependency {
TRANSCRIBE_STREAMING_MIDDLEWARE(NORMAL_DEPENDENCY, "@aws-sdk/middleware-sdk-transcribe-streaming"),
STS_MIDDLEWARE(NORMAL_DEPENDENCY, "@aws-sdk/middleware-sdk-sts"),
STS_CLIENT(NORMAL_DEPENDENCY, "@aws-sdk/client-sts"),
STS_CLIENT_PEER(PEER_DEPENDENCY, "@aws-sdk/client-sts"),
SSO_OIDC_CLIENT(NORMAL_DEPENDENCY, "@aws-sdk/client-sso-oidc"),
MIDDLEWARE_LOGGER(NORMAL_DEPENDENCY, "@aws-sdk/middleware-logger"),
MIDDLEWARE_USER_AGENT("dependencies", "@aws-sdk/middleware-user-agent"),
Expand Down

0 comments on commit 1cc4de9

Please sign in to comment.