Table of Contents

Class CfnUserPool

Namespace
Amazon.CDK.AWS.Cognito
Assembly
Amazon.CDK.AWS.Cognito.dll

A CloudFormation AWS::Cognito::UserPool.

public class CfnUserPool : CfnResource, IInspectable
Inheritance
CfnUserPool
Implements
IInspectable

Examples

// The code below shows an example of how to instantiate this type.
             // The values are placeholders you should change.
             using Amazon.CDK.AWS.Cognito;

             var userPoolTags;

             var cfnUserPool = new CfnUserPool(this, "MyCfnUserPool", new CfnUserPoolProps {
                 AccountRecoverySetting = new AccountRecoverySettingProperty {
                     RecoveryMechanisms = new [] { new RecoveryOptionProperty {
                         Name = "name",
                         Priority = 123
                     } }
                 },
                 AdminCreateUserConfig = new AdminCreateUserConfigProperty {
                     AllowAdminCreateUserOnly = false,
                     InviteMessageTemplate = new InviteMessageTemplateProperty {
                         EmailMessage = "emailMessage",
                         EmailSubject = "emailSubject",
                         SmsMessage = "smsMessage"
                     },
                     UnusedAccountValidityDays = 123
                 },
                 AliasAttributes = new [] { "aliasAttributes" },
                 AutoVerifiedAttributes = new [] { "autoVerifiedAttributes" },
                 DeletionProtection = "deletionProtection",
                 DeviceConfiguration = new DeviceConfigurationProperty {
                     ChallengeRequiredOnNewDevice = false,
                     DeviceOnlyRememberedOnUserPrompt = false
                 },
                 EmailConfiguration = new EmailConfigurationProperty {
                     ConfigurationSet = "configurationSet",
                     EmailSendingAccount = "emailSendingAccount",
                     From = "from",
                     ReplyToEmailAddress = "replyToEmailAddress",
                     SourceArn = "sourceArn"
                 },
                 EmailVerificationMessage = "emailVerificationMessage",
                 EmailVerificationSubject = "emailVerificationSubject",
                 EnabledMfas = new [] { "enabledMfas" },
                 LambdaConfig = new LambdaConfigProperty {
                     CreateAuthChallenge = "createAuthChallenge",
                     CustomEmailSender = new CustomEmailSenderProperty {
                         LambdaArn = "lambdaArn",
                         LambdaVersion = "lambdaVersion"
                     },
                     CustomMessage = "customMessage",
                     CustomSmsSender = new CustomSMSSenderProperty {
                         LambdaArn = "lambdaArn",
                         LambdaVersion = "lambdaVersion"
                     },
                     DefineAuthChallenge = "defineAuthChallenge",
                     KmsKeyId = "kmsKeyId",
                     PostAuthentication = "postAuthentication",
                     PostConfirmation = "postConfirmation",
                     PreAuthentication = "preAuthentication",
                     PreSignUp = "preSignUp",
                     PreTokenGeneration = "preTokenGeneration",
                     UserMigration = "userMigration",
                     VerifyAuthChallengeResponse = "verifyAuthChallengeResponse"
                 },
                 MfaConfiguration = "mfaConfiguration",
                 Policies = new PoliciesProperty {
                     PasswordPolicy = new PasswordPolicyProperty {
                         MinimumLength = 123,
                         RequireLowercase = false,
                         RequireNumbers = false,
                         RequireSymbols = false,
                         RequireUppercase = false,
                         TemporaryPasswordValidityDays = 123
                     }
                 },
                 Schema = new [] { new SchemaAttributeProperty {
                     AttributeDataType = "attributeDataType",
                     DeveloperOnlyAttribute = false,
                     Mutable = false,
                     Name = "name",
                     NumberAttributeConstraints = new NumberAttributeConstraintsProperty {
                         MaxValue = "maxValue",
                         MinValue = "minValue"
                     },
                     Required = false,
                     StringAttributeConstraints = new StringAttributeConstraintsProperty {
                         MaxLength = "maxLength",
                         MinLength = "minLength"
                     }
                 } },
                 SmsAuthenticationMessage = "smsAuthenticationMessage",
                 SmsConfiguration = new SmsConfigurationProperty {
                     ExternalId = "externalId",
                     SnsCallerArn = "snsCallerArn",
                     SnsRegion = "snsRegion"
                 },
                 SmsVerificationMessage = "smsVerificationMessage",
                 UserAttributeUpdateSettings = new UserAttributeUpdateSettingsProperty {
                     AttributesRequireVerificationBeforeUpdate = new [] { "attributesRequireVerificationBeforeUpdate" }
                 },
                 UsernameAttributes = new [] { "usernameAttributes" },
                 UsernameConfiguration = new UsernameConfigurationProperty {
                     CaseSensitive = false
                 },
                 UserPoolAddOns = new UserPoolAddOnsProperty {
                     AdvancedSecurityMode = "advancedSecurityMode"
                 },
                 UserPoolName = "userPoolName",
                 UserPoolTags = userPoolTags,
                 VerificationMessageTemplate = new VerificationMessageTemplateProperty {
                     DefaultEmailOption = "defaultEmailOption",
                     EmailMessage = "emailMessage",
                     EmailMessageByLink = "emailMessageByLink",
                     EmailSubject = "emailSubject",
                     EmailSubjectByLink = "emailSubjectByLink",
                     SmsMessage = "smsMessage"
                 }
             });

Remarks

The AWS::Cognito::UserPool resource creates an Amazon Cognito user pool. For more information on working with Amazon Cognito user pools, see Amazon Cognito User Pools and CreateUserPool .

If you don't specify a value for a parameter, Amazon Cognito sets it to a default value.

CloudformationResource: AWS::Cognito::UserPool

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html

ExampleMetadata: fixture=_generated

Constructors

CfnUserPool(Construct, string, ICfnUserPoolProps?)

Create a new AWS::Cognito::UserPool.

public CfnUserPool(Construct scope, string id, ICfnUserPoolProps? props = null)

Parameters

scope Construct
  • scope in which this resource is defined.
id string
  • scoped id of the resource.
props ICfnUserPoolProps
  • resource properties.

Properties

AccountRecoverySetting

Use this setting to define which verified available method a user can use to recover their password when they call ForgotPassword .

public virtual object? AccountRecoverySetting { get; set; }

Property Value

object

Remarks

It allows you to define a preferred method when a user has more than one method available. With this setting, SMS does not qualify for a valid password recovery mechanism if the user also has SMS MFA enabled. In the absence of this setting, Cognito uses the legacy behavior to determine the recovery method where SMS is preferred over email.

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-accountrecoverysetting

AdminCreateUserConfig

The configuration for creating a new user profile.

public virtual object? AdminCreateUserConfig { get; set; }

Property Value

object

Remarks

AliasAttributes

Attributes supported as an alias for this user pool. Possible values: phone_number , email , or preferred_username .

public virtual string[]? AliasAttributes { get; set; }

Property Value

string[]

Remarks

AttrArn

The Amazon Resource Name (ARN) of the user pool, such as arn:aws:cognito-idp:us-east-1:123412341234:userpool/us-east-1_123412341 .

public virtual string AttrArn { get; }

Property Value

string

Remarks

CloudformationAttribute: Arn

AttrProviderName

The provider name of the Amazon Cognito user pool, specified as a String .

public virtual string AttrProviderName { get; }

Property Value

string

Remarks

CloudformationAttribute: ProviderName

AttrProviderUrl

The URL of the provider of the Amazon Cognito user pool, specified as a String .

public virtual string AttrProviderUrl { get; }

Property Value

string

Remarks

CloudformationAttribute: ProviderURL

AutoVerifiedAttributes

The attributes to be auto-verified.

public virtual string[]? AutoVerifiedAttributes { get; set; }

Property Value

string[]

Remarks

CFN_RESOURCE_TYPE_NAME

The CloudFormation resource type name for this resource class.

public static string CFN_RESOURCE_TYPE_NAME { get; }

Property Value

string

CfnProperties

protected override IDictionary<string, object> CfnProperties { get; }

Property Value

IDictionary<string, object>

DeletionProtection

When active, DeletionProtection prevents accidental deletion of your user pool.

public virtual string? DeletionProtection { get; set; }

Property Value

string

Remarks

Before you can delete a user pool that you have protected against deletion, you must deactivate this feature.

When you try to delete a protected user pool in a DeleteUserPool API request, Amazon Cognito returns an InvalidParameterException error. To delete a protected user pool, send a new DeleteUserPool request after you deactivate deletion protection in an UpdateUserPool API request.

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-deletionprotection

DeviceConfiguration

The device-remembering configuration for a user pool.

public virtual object? DeviceConfiguration { get; set; }

Property Value

object

Remarks

A null value indicates that you have deactivated device remembering in your user pool.

When you provide a value for any <code>DeviceConfiguration</code> field, you activate the Amazon Cognito device-remembering feature.

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-deviceconfiguration

EmailConfiguration

The email configuration of your user pool.

public virtual object? EmailConfiguration { get; set; }

Property Value

object

Remarks

The email configuration type sets your preferred sending method, AWS Region, and sender for messages from your user pool.

Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-emailconfiguration

EmailVerificationMessage

This parameter is no longer used.

public virtual string? EmailVerificationMessage { get; set; }

Property Value

string

Remarks

EmailVerificationSubject

This parameter is no longer used.

public virtual string? EmailVerificationSubject { get; set; }

Property Value

string

Remarks

EnabledMfas

Enables MFA on a specified user pool.

public virtual string[]? EnabledMfas { get; set; }

Property Value

string[]

Remarks

To disable all MFAs after it has been enabled, set MfaConfiguration to “OFF” and remove EnabledMfas. MFAs can only be all disabled if MfaConfiguration is OFF. Once SMS_MFA is enabled, SMS_MFA can only be disabled by setting MfaConfiguration to “OFF”. Can be one of the following values:

    Allowed values: SMS_MFA | SOFTWARE_TOKEN_MFA

    Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-enabledmfas

    LambdaConfig

    The Lambda trigger configuration information for the new user pool.

    public virtual object? LambdaConfig { get; set; }

    Property Value

    object

    Remarks

    In a push model, event sources (such as Amazon S3 and custom applications) need permission to invoke a function. So you must make an extra call to add permission for these event sources to invoke your Lambda function.
    

    For more information on using the Lambda API to add permission, see AddPermission .

    For adding permission using the AWS CLI , see add-permission .

    Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-lambdaconfig

    MfaConfiguration

    The multi-factor authentication (MFA) configuration. Valid values include:.

    public virtual string? MfaConfiguration { get; set; }

    Property Value

    string

    Remarks

    Policies

    The policy associated with a user pool.

    public virtual object? Policies { get; set; }

    Property Value

    object

    Remarks

    Schema

    The schema attributes for the new user pool. These attributes can be standard or custom attributes.

    public virtual object? Schema { get; set; }

    Property Value

    object

    Remarks

    During a user pool update, you can add new schema attributes but you cannot modify or delete an existing schema attribute.
    

    Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-schema

    SmsAuthenticationMessage

    A string representing the SMS authentication message.

    public virtual string? SmsAuthenticationMessage { get; set; }

    Property Value

    string

    Remarks

    SmsConfiguration

    The SMS configuration with the settings that your Amazon Cognito user pool must use to send an SMS message from your AWS account through Amazon Simple Notification Service.

    public virtual object? SmsConfiguration { get; set; }

    Property Value

    object

    Remarks

    To send SMS messages with Amazon SNS in the AWS Region that you want, the Amazon Cognito user pool uses an AWS Identity and Access Management (IAM) role in your AWS account .

    Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-smsconfiguration

    SmsVerificationMessage

    This parameter is no longer used.

    public virtual string? SmsVerificationMessage { get; set; }

    Property Value

    string

    Remarks

    Tags

    The tag keys and values to assign to the user pool.

    public virtual TagManager Tags { get; }

    Property Value

    TagManager

    Remarks

    A tag is a label that you can use to categorize and manage user pools in different ways, such as by purpose, owner, environment, or other criteria.

    Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-userpooltags

    UserAttributeUpdateSettings

    The settings for updates to user attributes.

    public virtual object? UserAttributeUpdateSettings { get; set; }

    Property Value

    object

    Remarks

    These settings include the property AttributesRequireVerificationBeforeUpdate , a user-pool setting that tells Amazon Cognito how to handle changes to the value of your users' email address and phone number attributes. For more information, see Verifying updates to email addresses and phone numbers .

    Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-userattributeupdatesettings

    UserPoolAddOns

    Enables advanced security risk detection.

    public virtual object? UserPoolAddOns { get; set; }

    Property Value

    object

    Remarks

    UserPoolName

    A string used to name the user pool.

    public virtual string? UserPoolName { get; set; }

    Property Value

    string

    Remarks

    UsernameAttributes

    Determines whether email addresses or phone numbers can be specified as user names when a user signs up.

    public virtual string[]? UsernameAttributes { get; set; }

    Property Value

    string[]

    Remarks

    Possible values: phone_number or email .

    This user pool property cannot be updated.

    Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-usernameattributes

    UsernameConfiguration

    You can choose to set case sensitivity on the username input for the selected sign-in option.

    public virtual object? UsernameConfiguration { get; set; }

    Property Value

    object

    Remarks

    For example, when this is set to False , users will be able to sign in using either "username" or "Username". This configuration is immutable once it has been set.

    Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-usernameconfiguration

    VerificationMessageTemplate

    The template for the verification message that the user sees when the app requests permission to access the user's information.

    public virtual object? VerificationMessageTemplate { get; set; }

    Property Value

    object

    Remarks

    Methods

    Inspect(TreeInspector)

    Examines the CloudFormation resource and discloses attributes.

    public virtual void Inspect(TreeInspector inspector)

    Parameters

    inspector TreeInspector
    • tree inspector to collect and process attributes.

    RenderProperties(IDictionary<string, object>)

    protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)

    Parameters

    props IDictionary<string, object>

    Returns

    IDictionary<string, object>