Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cloud/lib/authentication/authCloudFormation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,13 @@ describe("Application stack [Auth]", () => {
},
});
});

it("should have a admin User Pool Group resource", () => {
template.hasResource("AWS::Cognito::UserPoolGroup", {
Properties: {
description: "Group for admin users",
groupName: "Admins",
},
});
});
});
4 changes: 3 additions & 1 deletion cloud/lib/authentication/cognitoCdkConstruct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export class CognitoCdkConstruct extends Construct {
const { userPool, userPoolClient } = new CognitoUserPoolCdkConstruct(
this,
`${envName}-CognitoUserPool`,
{ envName }
{
envName,
}
);

const { identityPool, identityPoolRoleAttachment } =
Expand Down
12 changes: 12 additions & 0 deletions cloud/lib/authentication/cognitoUserPoolCdkConstruct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ interface CognitoUserPoolProps {
export class CognitoUserPoolCdkConstruct extends Construct {
public userPool: cognito.UserPool;
public userPoolClient: cognito.UserPoolClient;
public adminPoolGroup: cognito.CfnUserPoolGroup;

constructor(
scope: Construct,
id: string,
Expand Down Expand Up @@ -56,6 +58,16 @@ export class CognitoUserPoolCdkConstruct extends Construct {
}
);

this.adminPoolGroup = new cognito.CfnUserPoolGroup(
this,
`${envName}-AdminUserPoolGroup`,
{
userPoolId: this.userPool.userPoolId,
description: "Group for admin users",
groupName: "Admins",
}
);

this.userPoolClient.node.addDependency(this.userPool);

const { messageLambda } = new EmailsCdkConstruct(
Expand Down
Loading