@@ -512,27 +512,35 @@ export const auth = defineAuth({
512512
513513## Override default password policy
514514
515- You can customize the password format acceptable by your auth backend. By default your password policy is set to the following:
515+ By default your password policy is set to the following:
516516
517517- `MinLength`: 8 characters
518518- `requireLowercase`: true
519519- `requireUppercase`: true
520- - `requireDigits`: true
520+ - `requireNumbers`: true
521+ - `requireSymbols`: true
521522- `tempPasswordValidity`: 3 days
522523
524+ You can customize the password format acceptable by your auth resource by modifying the underlying `cfnUserPool` resource:
525+
523526```ts title=" amplify/ backend.ts "
524- // amplify/backend.ts
525527import { defineBackend } from '@aws-amplify/backend';
526528import { auth } from './auth/resource';
527- import { data } from './data/resource';
528529
529530const backend = defineBackend({
530531 auth,
531- data
532532});
533-
534- // extract L1 UserPool construct
533+ // extract L1 CfnUserPool resources
535534const { cfnUserPool } = backend.auth.resources.cfnResources;
536- // from the CDK use `addPropertyOverride` to modify properties directly
537- cfnUserPool.addPropertyOverride('Policies.PasswordPolicy.MinimumLength', 32);
535+ // modify cfnUserPool policies directly
536+ cfnUserPool.policies = {
537+ passwordPolicy: {
538+ minimumLength: 32,
539+ requireLowercase: true,
540+ requireNumbers: true,
541+ requireSymbols: true,
542+ requireUppercase: true,
543+ temporaryPasswordValidityDays: 20,
544+ },
545+ };
538546```
0 commit comments