Skip to content

Commit

Permalink
fix: use name instead of type
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Jan 31, 2025
1 parent 22d75c5 commit 85e05a5
Showing 1 changed file with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,30 +70,34 @@ export const configureAdminCognitoFederation = (
);

const providers: Array<{
type: string;
name: string;
config: aws.cognito.IdentityProviderArgs;
resource: PulumiAppResource<typeof aws.cognito.IdentityProvider>;
}> = [];

for (const idp of config.identityProviders) {
// For built-in identity providers, we use the type as the name. Only for OIDC,
// we allow the user to provide a custom name and we only use the type as a fallback.
let name = idp.type as string;
if (idp.type === "oidc") {
name = idp.name || idp.type;
}
const config = getIdpConfig(idp.type, userPool.output.id, idp);

providers.push({
type: idp.type,
name,
config,
resource: app.addResource(aws.cognito.IdentityProvider, {
name,
config: getIdpConfig(idp.type, userPool.output.id, idp)
name: config.providerName.toString(),
config
})
});
}

appClient.config.supportedIdentityProviders(["COGNITO", ...providers.map(p => p.name)]);
appClient.config.supportedIdentityProviders([
"COGNITO",
...providers.map(p => {
// For built-in identity providers, we use the type as the name. Only for OIDC,
// we allow the user to provide a custom name, and we only use the type as a fallback.
if (p.config.providerType === "OIDC") {
return p.config.providerName;
}
return p.config.providerType;
})
]);

appClient.config.allowedOauthScopes(["profile", "email", "openid"]);
appClient.config.allowedOauthFlows(["implicit", "code"]);
appClient.config.allowedOauthFlowsUserPoolClient(true);
Expand Down

0 comments on commit 85e05a5

Please sign in to comment.