aws-cdk-lib.aws_cognito.PasswordPolicy

interface PasswordPolicy

LanguageType name
.NETAmazon.CDK.AWS.Cognito.PasswordPolicy
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscognito#PasswordPolicy
Javasoftware.amazon.awscdk.services.cognito.PasswordPolicy
Pythonaws_cdk.aws_cognito.PasswordPolicy
TypeScript (source)aws-cdk-lib » aws_cognito » PasswordPolicy

Password policy for User Pools.

Example

new cognito.UserPool(this, 'myuserpool', {
  // ...
  passwordPolicy: {
    minLength: 12,
    requireLowercase: true,
    requireUppercase: true,
    requireDigits: true,
    requireSymbols: true,
    tempPasswordValidity: Duration.days(3),
  },
});

Properties

NameTypeDescription
minLength?numberMinimum length required for a user's password.
requireDigits?booleanWhether the user is required to have digits in their password.
requireLowercase?booleanWhether the user is required to have lowercase characters in their password.
requireSymbols?booleanWhether the user is required to have symbols in their password.
requireUppercase?booleanWhether the user is required to have uppercase characters in their password.
tempPasswordValidity?DurationThe length of time the temporary password generated by an admin is valid.

minLength?

Type: number (optional, default: 8)

Minimum length required for a user's password.


requireDigits?

Type: boolean (optional, default: true)

Whether the user is required to have digits in their password.


requireLowercase?

Type: boolean (optional, default: true)

Whether the user is required to have lowercase characters in their password.


requireSymbols?

Type: boolean (optional, default: true)

Whether the user is required to have symbols in their password.


requireUppercase?

Type: boolean (optional, default: true)

Whether the user is required to have uppercase characters in their password.


tempPasswordValidity?

Type: Duration (optional, default: Duration.days(7))

The length of time the temporary password generated by an admin is valid.

This must be provided as whole days, like Duration.days(3) or Duration.hours(48). Fractional days, such as Duration.hours(20), will generate an error.