@@ -512,27 +512,35 @@ export const auth = defineAuth({
512
512
513
513
## Override default password policy
514
514
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:
516
516
517
517
- `MinLength`: 8 characters
518
518
- `requireLowercase`: true
519
519
- `requireUppercase`: true
520
- - `requireDigits`: true
520
+ - `requireNumbers`: true
521
+ - `requireSymbols`: true
521
522
- `tempPasswordValidity`: 3 days
522
523
524
+ You can customize the password format acceptable by your auth resource by modifying the underlying `cfnUserPool` resource:
525
+
523
526
```ts title=" amplify/ backend.ts "
524
- // amplify/backend.ts
525
527
import { defineBackend } from '@aws-amplify/backend';
526
528
import { auth } from './auth/resource';
527
- import { data } from './data/resource';
528
529
529
530
const backend = defineBackend({
530
531
auth,
531
- data
532
532
});
533
-
534
- // extract L1 UserPool construct
533
+ // extract L1 CfnUserPool resources
535
534
const { 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
+ };
538
546
```
0 commit comments