Skip to content

Commit 05bb1b0

Browse files
authored
update password policy override (#8034)
* update password policy override * adjust prose
1 parent 0f76294 commit 05bb1b0

File tree

1 file changed

+17
-9
lines changed
  • src/pages/[platform]/build-a-backend/auth/manage-users/manage-passwords

1 file changed

+17
-9
lines changed

src/pages/[platform]/build-a-backend/auth/manage-users/manage-passwords/index.mdx

+17-9
Original file line numberDiff line numberDiff line change
@@ -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
525527
import { defineBackend } from '@aws-amplify/backend';
526528
import { auth } from './auth/resource';
527-
import { data } from './data/resource';
528529
529530
const backend = defineBackend({
530531
auth,
531-
data
532532
});
533-
534-
// extract L1 UserPool construct
533+
// extract L1 CfnUserPool resources
535534
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+
};
538546
```

0 commit comments

Comments
 (0)