Skip to content

Commit

Permalink
check featurePlan
Browse files Browse the repository at this point in the history
  • Loading branch information
Tietew committed Dec 5, 2024
1 parent 09dba49 commit 0d5449e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/aws-cdk-lib/aws-cognito/lib/user-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,9 @@ export class UserPool extends UserPoolBase {
return undefined;
}

// TODO: validate whether the feature plan is not Lite
if (props.featurePlan === FeaturePlan.LITE) {
throw new Error('To enable passwordless sign-in, set `featurePlan` to `FeaturePlan.ESSENTIALS` or `FeaturePlan.PLUS`.');
}

const allowedFirstAuthFactors = ['PASSWORD'];
if (props.allowedFirstAuthFactors.emailOtp) {
Expand Down
13 changes: 12 additions & 1 deletion packages/aws-cdk-lib/aws-cognito/test/user-pool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2128,7 +2128,18 @@ describe('User Pool', () => {
});
});

// TODO: test('allowFirstAuthFactors throws when the feature plan is Lite')
test('allowFirstAuthFactors throws when the feature plan is Lite', () => {
// GIVEN
const stack = new Stack();

// WHEN
expect(() => {
new UserPool(stack, 'Pool', {
allowedFirstAuthFactors: { emailOtp: true },
featurePlan: FeaturePlan.LITE,
});
}).toThrow('To enable passwordless sign-in, set `featurePlan` to `FeaturePlan.ESSENTIALS` or `FeaturePlan.PLUS`.');
});

test('passkeyRelyingPartyId is configured', () => {
// GIVEN
Expand Down

0 comments on commit 0d5449e

Please sign in to comment.