Skip to content

update custom attribute and password policy example #7635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 21, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,17 @@ const backend = defineBackend({
});
// extract L1 CfnUserPool resources
const { cfnUserPool } = backend.auth.resources.cfnResources;
// use CDK's `addPropertyOverride` to modify properties directly
cfnUserPool.addPropertyOverride(
"Policies",
{
PasswordPolicy: {
MinimumLength: 10,
RequireLowercase: true,
RequireNumbers: true,
RequireSymbols: true,
RequireUppercase: true,
TemporaryPasswordValidityDays: 20,
},
}
);
// modify cfnUserPool policies directly
cfnUserPool.policies = {
passwordPolicy: {
minimumLength: 10,
requireLowercase: true,
requireNumbers: true,
requireSymbols: true,
requireUppercase: true,
temporaryPasswordValidityDays: 20,
},
};
```

## Custom Attributes
Expand All @@ -76,14 +73,14 @@ const backend = defineBackend({

// extract L1 CfnUserPool resources
const { cfnUserPool } = backend.auth.resources.cfnResources;
// use CDK's `addPropertyOverride` to modify properties directly
cfnUserPool.addPropertyOverride("Schema", [
{
Name: "publicName",
AttributeDataType: "String",
Mutable: true,
},
]);
// update the schema property to add custom attributes
if (Array.isArray(cfnUserPool.schema)) {
cfnUserPool.schema.push({
name: 'policyName',
attributeDataType: 'Boolean',
developerOnlyAttribute: true,
});
}
```

{/* token validity */}
Expand Down
Loading