Skip to content
v2.273.0

PasswordPolicy Struct ​

Password policy for User Pools.

Example ​

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

Properties ​

minLengthnumbermin_lengthint | floatminLengthNumberMinLengthdoubleMinLength*float64= 8#
Minimum length required for a user's password.
passwordHistorySizenumberpassword_history_sizeint | floatpasswordHistorySizeNumberPasswordHistorySizedoublePasswordHistorySize*float64= undefined - Cognito default sett…#
The number of previous passwords that you want Amazon Cognito to restrict each user from reusing.

passwordHistorySize cannot be set when featurePlan is FeaturePlan.LITE.

default

Default: undefined - Cognito default setting is no restriction

requireDigitsbooleanrequire_digitsboolrequireDigitsBooleanRequireDigitsboolRequireDigits*bool= true#
Whether the user is required to have digits in their password.
requireLowercasebooleanrequire_lowercaseboolrequireLowercaseBooleanRequireLowercaseboolRequireLowercase*bool= true#
Whether the user is required to have lowercase characters in their password.
requireSymbolsbooleanrequire_symbolsboolrequireSymbolsBooleanRequireSymbolsboolRequireSymbols*bool= true#
Whether the user is required to have symbols in their password.
requireUppercasebooleanrequire_uppercaseboolrequireUppercaseBooleanRequireUppercaseboolRequireUppercase*bool= true#
Whether the user is required to have uppercase characters in their password.
tempPasswordValidityDurationtemp_password_validityDurationtempPasswordValidityDurationTempPasswordValidityDurationTempPasswordValidityDuration= 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.