Skip to content

Commit 85339fa

Browse files
authored
fix: use name instead of type (#4506)
1 parent 2cafe56 commit 85339fa

File tree

1 file changed

+18
-8
lines changed
  • packages/pulumi-aws/src/apps/core/cognitoIdentityProviders

1 file changed

+18
-8
lines changed

packages/pulumi-aws/src/apps/core/cognitoIdentityProviders/configure.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,29 @@ export const configureAdminCognitoFederation = (
6969
pulumi.interpolate`${userPoolDomain.output.domain}.auth.${region}.amazoncognito.com`
7070
);
7171

72-
const providers = [];
72+
const idpConfigs: aws.cognito.IdentityProviderArgs[] = [];
73+
7374
for (const idp of config.identityProviders) {
74-
providers.push(
75-
app.addResource(aws.cognito.IdentityProvider, {
76-
name: idp.type,
77-
config: getIdpConfig(idp.type, userPool.output.id, idp)
78-
})
79-
);
75+
const config = getIdpConfig(idp.type, userPool.output.id, idp);
76+
77+
app.addResource(aws.cognito.IdentityProvider, {
78+
name: config.providerName.toString(),
79+
config
80+
});
81+
82+
idpConfigs.push(config);
8083
}
8184

8285
appClient.config.supportedIdentityProviders([
8386
"COGNITO",
84-
...providers.map(p => p.output.providerType)
87+
...idpConfigs.map(config => {
88+
// For built-in identity providers, we use the type as the name. Only for OIDC,
89+
// we allow the user to provide a custom name, and we only use the type as a fallback.
90+
if (config.providerType === "OIDC") {
91+
return config.providerName;
92+
}
93+
return config.providerType;
94+
})
8595
]);
8696

8797
appClient.config.allowedOauthScopes(["profile", "email", "openid"]);

0 commit comments

Comments
 (0)