【问题标题】:AWS Cognito UserPool - Recovery OptionAWS Cognito UserPool - 恢复选项
【发布时间】:2020-07-03 20:08:18
【问题描述】:
【问题讨论】:
标签:
amazon-web-services
amazon-cloudformation
amazon-cognito
aws-userpools
【解决方案2】:
RecoveryOptions 是 RecoveryMechanism 的一部分,它是 AccountRecoverySetting 的一部分:
{
"RecoveryMechanisms" : [ RecoveryOption, ... ]
}
这是一个具有恢复选项的用户池示例,将所有内容放在 CloudFormation 模板中,如下所示:
testUserPool:
DependsOn: [ cognitoSMSRole ]
Type: AWS::Cognito::UserPool
Properties:
AccountRecoverySetting:
RecoveryMechanisms:
- Name: verified_email
Priority: 1
- Name: verified_phone_number
Priority: 2
AdminCreateUserConfig:
AllowAdminCreateUserOnly: False
AutoVerifiedAttributes:
- phone_number
EnabledMfas:
- SMS_MFA
MfaConfiguration: OPTIONAL
Policies:
PasswordPolicy:
MinimumLength: 8
RequireLowercase: True
RequireNumbers: True
RequireSymbols: True
RequireUppercase: True
TemporaryPasswordValidityDays: 7
Schema:
- AttributeDataType: String
DeveloperOnlyAttribute: False
Mutable: False
Name: name
Required: True
- AttributeDataType: String
DeveloperOnlyAttribute: False
Mutable: False
Name: last_name
Required: False
SmsConfiguration:
ExternalId: !Sub cognito-sms-role-prod
SnsCallerArn: !GetAtt cognitoSMSRole.Arn
UsernameAttributes:
- phone_number
UsernameConfiguration:
CaseSensitive: False
UserPoolName: !Sub UserPool-prod