Namespace Amazon.CDK.AWS.Cognito
Amazon Cognito Construct Library
Amazon Cognito provides authentication, authorization, and user management for your web and mobile apps. Your users can sign in directly with a user name and password, or through a third party such as Facebook, Amazon, Google or Apple.
The two main components of Amazon Cognito are user pools and identity pools. User pools are user directories that provide sign-up and sign-in options for your app users. Identity pools enable you to grant your users access to other AWS services. Identity Pool L2 Constructs can be found here.
This module is part of the AWS Cloud Development Kit project.
Table of Contents
User Pools
User pools allow creating and managing your own directory of users that can sign up and sign in. They enable easy integration with social identity providers such as Facebook, Google, Amazon, Microsoft Active Directory, etc. through SAML.
Using the CDK, a new user pool can be created as part of the stack using the construct's constructor. You may specify
the userPoolName
to give your own identifier to the user pool. If not, CloudFormation will generate a name.
new UserPool(this, "myuserpool", new UserPoolProps {
UserPoolName = "myawesomeapp-userpool",
SignInCaseSensitive = false
});
By default, usernames and email addresses in user pools are case sensitive, which means user@example.com
and User@example.com
are considered different. In most situations it is preferred to have usernames and email addresses be case insensitive so that
capitalization differences are ignored. As shown above, you can make a user pool case insensitive by setting signInCaseSensitive
to false
. The case sensitivity cannot be changed once a user pool is created.
The default set up for the user pool is configured such that only administrators will be allowed to create users. Features such as Multi-factor authentication (MFAs) and Lambda Triggers are not configured by default.
Use the grant()
method to add an IAM policy statement associated with the user pool to an
IAM principal's policy.
var userPool = new UserPool(this, "myuserpool");
var role = new Role(this, "role", new RoleProps {
AssumedBy = new ServicePrincipal("foo")
});
userPool.Grant(role, "cognito-idp:AdminCreateUser");
User pool feature plans
Amazon Cognito has feature plans for user pools. Each plan has a set of features and a monthly cost per active user. Each feature plan unlocks access to more features than the one before it. Learn more about feature plans here.
The default feature plan is Essentials for newly create user pools. For the existing user pools, Lite plan is automatically set.
Previously, some user pool features were included in an advanced security features pricing structure. The features that were included in this structure are now under either the Essentials or Plus plan.
Sign Up
Users can either be signed up by the app's administrators or can sign themselves up. Once a user has signed up, their account needs to be confirmed. Cognito provides several ways to sign users up and confirm their accounts. Learn more about user sign up here.
To verify the email address of a user in your user pool with Amazon Cognito, you can send the user an email message with a link that they can select, or you can send them a code that they can enter.
Code Verification
When a user signs up, email and SMS messages are used to verify their account and contact methods. The following code snippet configures a user pool with properties relevant to these verification messages -
new UserPool(this, "myuserpool", new UserPoolProps {
// ...
SelfSignUpEnabled = true,
UserVerification = new UserVerificationConfig {
EmailSubject = "Verify your email for our awesome app!",
EmailBody = "Thanks for signing up to our awesome app! Your verification code is {####}",
EmailStyle = VerificationEmailStyle.CODE,
SmsMessage = "Thanks for signing up to our awesome app! Your verification code is {####}"
}
});
By default, self sign up is disabled. Learn more about email and SMS verification messages here.
Besides users signing themselves up, an administrator of any user pool can sign users up. The user then receives an invitation to join the user pool. The following code snippet configures a user pool with properties relevant to the invitation messages -
new UserPool(this, "myuserpool", new UserPoolProps {
// ...
UserInvitation = new UserInvitationConfig {
EmailSubject = "Invite to join our awesome app!",
EmailBody = "Hello {username}, you have been invited to join our awesome app! Your temporary password is {####}",
SmsMessage = "Hello {username}, your temporary password for our awesome app is {####}"
}
});
Link Verification
Alternatively, users can use link as a verification method. The following code snippet configures a user pool with properties relevant to these verification messages and link verification method.
new UserPool(this, "myuserpool", new UserPoolProps {
UserVerification = new UserVerificationConfig {
EmailStyle = VerificationEmailStyle.LINK,
EmailSubject = "Invite to join our awesome app!",
EmailBody = "You have been invited to join our awesome app! {##Verify Your Email##}"
}
});
All email subjects, bodies and SMS messages for both invitation and verification support Cognito's message templating. Learn more about message templates here.
Sign In
Users registering or signing in into your application can do so with multiple identifiers. There are 4 options available:
The following code sets up a user pool so that the user can sign in with either their username or their email address -
new UserPool(this, "myuserpool", new UserPoolProps {
// ...
// ...
SignInAliases = new SignInAliases {
Username = true,
Email = true
}
});
User pools can either be configured so that user name is primary sign in form, but also allows for the other three to be used additionally; or it can be configured so that email and/or phone numbers are the only ways a user can register and sign in. Read more about this here.
⚠️ The Cognito service prevents changing the signInAlias
property for an existing user pool.
To match with 'Option 1' in the above link, with a verified email, signInAliases
should be set to
{ username: true, email: true }
. To match with 'Option 2' in the above link with both a verified
email and phone number, this property should be set to { email: true, phone: true }
.
Cognito recommends that email and phone number be automatically verified, if they are one of the sign in methods for
the user pool. Read more about that
here.
The CDK does this by default, when email and/or phone number are specified as part of signInAliases
. This can be
overridden by specifying the autoVerify
property.
The following code snippet sets up only email as a sign in alias, but both email and phone number to be auto-verified.
new UserPool(this, "myuserpool", new UserPoolProps {
// ...
// ...
SignInAliases = new SignInAliases { Username = true, Email = true },
AutoVerify = new AutoVerifiedAttrs { Email = true, Phone = true }
});
A user pool can optionally ignore case when evaluating sign-ins. When signInCaseSensitive
is false, Cognito will not
check the capitalization of the alias when signing in. Default is true.
Choice-based authentication: passwordless sign-in / passkey sign-in
User pools can be configured to allow the following authentication methods in choice-based authentication:
To use choice-based authentication, User pool feature plan should be Essentials or higher.
For details of authentication methods and client implementation, see Manage authentication methods in AWS SDKs.
The following code configures a user pool with choice-based authentication enabled:
var userPool = new UserPool(this, "myuserpool", new UserPoolProps {
SignInPolicy = new SignInPolicy {
AllowedFirstAuthFactors = new AllowedFirstAuthFactors {
Password = true, // password authentication must be enabled
EmailOtp = true, // enables email message one-time password
SmsOtp = true, // enables SMS message one-time password
Passkey = true
}
}
});
// You should also configure the user pool client with USER_AUTH authentication flow allowed
userPool.AddClient("myclient", new UserPoolClientOptions {
AuthFlows = new AuthFlow { User = true }
});
⚠️ Enabling SMS message one-time password requires the AWS account be activated to SMS message sending. Learn more about SMS message settings for Amazon Cognito user pools.
When enabling passkey sign-in, you should specify the authentication domain used as the relying party ID. Learn more about passkey sign-in of user pools and Web Authentication API.
// Use the hosted Amazon Cognito domain as the relying party ID
// Use the hosted Amazon Cognito domain as the relying party ID
new UserPool(this, "myuserpool", new UserPoolProps {
SignInPolicy = new SignInPolicy {
AllowedFirstAuthFactors = new AllowedFirstAuthFactors { Password = true, Passkey = true }
},
PasskeyRelyingPartyId = "myclientname.auth.region-name.amazoncognito.com"
});
// Use the custom domain as the relying party ID
// Use the custom domain as the relying party ID
new UserPool(this, "myuserpool", new UserPoolProps {
SignInPolicy = new SignInPolicy {
AllowedFirstAuthFactors = new AllowedFirstAuthFactors { Password = true, Passkey = true }
},
PasskeyRelyingPartyId = "auth.example.com"
});
You can configure user verification to be preferred (default) or required. When you set user verification to preferred, users can set up authenticators that don't have the user verification capability, and registration and authentication operations can succeed without user verification. To mandate user verification in passkey registration and authentication, specify passkeyUserVerification
to PasskeyUserVerification.REQUIRED
.
new UserPool(this, "myuserpool", new UserPoolProps {
SignInPolicy = new SignInPolicy {
AllowedFirstAuthFactors = new AllowedFirstAuthFactors { Password = true, Passkey = true }
},
PasskeyRelyingPartyId = "auth.example.com",
PasskeyUserVerification = PasskeyUserVerification.REQUIRED
});
To disable choice-based authentication explicitly, specify password
only.
new UserPool(this, "myuserpool", new UserPoolProps {
SignInPolicy = new SignInPolicy {
AllowedFirstAuthFactors = new AllowedFirstAuthFactors { Password = true }
},
FeaturePlan = FeaturePlan.LITE
});
Attributes
Attributes represent the various properties of each user that's collected and stored in the user pool. Cognito provides a set of standard attributes that are available for all user pools. Users are allowed to select any of these standard attributes to be required. Users will not be able to sign up to the user pool without providing the required attributes. Besides these, additional attributes can be further defined, and are known as custom attributes.
Learn more on attributes in Cognito's documentation.
The following code configures a user pool with two standard attributes (name and address) as required and mutable, and adds four custom attributes.
new UserPool(this, "myuserpool", new UserPoolProps {
// ...
StandardAttributes = new StandardAttributes {
Fullname = new StandardAttribute {
Required = true,
Mutable = false
},
Address = new StandardAttribute {
Required = false,
Mutable = true
}
},
CustomAttributes = new Dictionary<string, ICustomAttribute> {
{ "myappid", new StringAttribute(new StringAttributeProps { MinLen = 5, MaxLen = 15, Mutable = false }) },
{ "callingcode", new NumberAttribute(new NumberAttributeProps { Min = 1, Max = 3, Mutable = true }) },
{ "isEmployee", new BooleanAttribute(new CustomAttributeProps { Mutable = true }) },
{ "joinedOn", new DateTimeAttribute() }
}
});
As shown in the code snippet, there are data types that are available for custom attributes. The 'String' and 'Number' data types allow for further constraints on their length and values, respectively.
Custom attributes cannot be marked as required.
All custom attributes share the property mutable
that specifies whether the value of the attribute can be changed.
The default value is false
.
User pools come with two 'built-in' attributes - email_verified
and phone_number_verified
. These cannot be
configured (required-ness or mutability) as part of user pool creation. However, user pool administrators can modify
them for specific users using the AdminUpdateUserAttributes API.
Attribute verification
When your user updates an email address or phone number attribute, Amazon Cognito marks it unverified until they verify the new value. You can’t send messages to an unverified email address or phone number. Your user can’t sign in with an unverified alias attribute. You can choose how Amazon Cognito handles an updated email address or phone number after the update and before the verification.
Learn more on configuring email or phone verification in Cognito's documentation.
The following code configures a user pool that keeps the original value for the two standard attributes (email and phone_number) until the new values are verified.
new UserPool(this, "myuserpool", new UserPoolProps {
// ...
SignInAliases = new SignInAliases { Username = true },
AutoVerify = new AutoVerifiedAttrs { Email = true, Phone = true },
KeepOriginal = new KeepOriginalAttrs {
Email = true,
Phone = true
}
});
Security
Cognito sends various messages to its users via SMS, for different actions, ranging from account verification to marketing. In order to send SMS messages, Cognito needs an IAM role that it can assume, with permissions that allow it to send SMS messages.
By default, the CDK looks at all of the specified properties (and their defaults when not explicitly specified) and
automatically creates an SMS role, when needed. For example, if MFA second factor by SMS is enabled, the CDK will
create a new role. The smsRole
property can be used to specify the user supplied role that should be used instead.
Additionally, the property enableSmsRole
can be used to override the CDK's default behaviour to either enable or
suppress automatic role creation.
var poolSmsRole = new Role(this, "userpoolsmsrole", new RoleProps {
AssumedBy = new ServicePrincipal("foo")
});
new UserPool(this, "myuserpool", new UserPoolProps {
// ...
SmsRole = poolSmsRole,
SmsRoleExternalId = "c87467be-4f34-11ea-b77f-2e728ce88125"
});
When the smsRole
property is specified, the smsRoleExternalId
may also be specified. The value of
smsRoleExternalId
will be used as the sts:ExternalId
when the Cognito service assumes the role. In turn, the role's
assume role policy should be configured to accept this value as the ExternalId. Learn more about ExternalId
here.
Multi-factor Authentication (MFA)
User pools can be configured to enable multi-factor authentication (MFA). It can either be turned off, set to optional or made required. Setting MFA to optional means that individual users can choose to enable it. Additionally, the MFA code can be sent either via SMS text message or via a time-based software token. See the documentation on MFA to learn more.
The following code snippet marks MFA for the user pool as required. This means that all users are required to configure an MFA token and use it for sign in. It also allows for the users to use both SMS based MFA, as well, time-based one time password (TOTP).
If you want to enable email-based MFA, set email
property to the Amazon SES email-sending configuration and set featurePlan
to FeaturePlan.ESSENTIALS
or FeaturePlan.PLUS
.
For more information, see SMS and email message MFA.
new UserPool(this, "myuserpool", new UserPoolProps {
// ...
Mfa = Mfa.REQUIRED,
MfaSecondFactor = new MfaSecondFactor {
Sms = true,
Otp = true,
Email = false
}
});
User pools can be configured with policies around a user's password. This includes the password length and the character sets that they must contain.
Further to this, it can also be configured with the validity of the auto-generated temporary password. A temporary password is generated by the user pool either when an admin signs up a user or when a password reset is requested. The validity of this password dictates how long to give the user to use this password before expiring it.
You can also set a policy for password reuse by setting the passwordHistorySize
property.
You can prevent a user from resetting their password to a new password that matches their current password or any of up to 23 additional previous passwords, for a maximum total of 24.
The passwordHistorySize
property can not be set when featurePlan
is FeaturePlan.LITE
.
The following code snippet configures these properties -
new UserPool(this, "myuserpool", new UserPoolProps {
// ...
PasswordPolicy = new PasswordPolicy {
MinLength = 12,
RequireLowercase = true,
RequireUppercase = true,
RequireDigits = true,
RequireSymbols = true,
TempPasswordValidity = Duration.Days(3)
}
});
Note that, tempPasswordValidity
can be specified only in whole days. Specifying fractional days would throw an error.
Account Recovery Settings
User pools can be configured on which method a user should use when recovering the password for their account. This can either be email and/or SMS. Read more at Recovering User Accounts
new UserPool(this, "UserPool", new UserPoolProps {
// ...
AccountRecovery = AccountRecovery.EMAIL_ONLY
});
The default for account recovery is by phone if available and by email otherwise. A user will not be allowed to reset their password via phone if they are also using it for MFA.
Advanced Security Mode
⚠️ Advanced Security Mode is deprecated in favor of Threat Protection.
User pools can be configured to use Advanced security. You can turn the user pool advanced security features on, and customize the actions that are taken in response to different risks. Or you can use audit mode to gather metrics on detected risks without taking action. In audit mode, the advanced security features publish metrics to Amazon CloudWatch. See the documentation on Advanced security to learn more.
new UserPool(this, "myuserpool", new UserPoolProps {
// ...
AdvancedSecurityMode = AdvancedSecurityMode.ENFORCED
});
Threat Protection
This feature is only available if your Feature Plan is set to PLUS.
Threat Protection can be set to configure enforcement levels and automatic responses for users in password-based and custom-challenge authentication flows.
For configuration, there are 2 options for standard authentication and custom authentication.
These are represented with properties standardThreatProtectionMode
and customThreatProtectionMode
.
See the documentation on Threat Protection
Emails
Cognito sends emails to users in the user pool, when particular actions take place, such as welcome emails, invitation emails, password resets, etc. The address from which these emails are sent can be configured on the user pool. Read more at Email settings for User Pools.
By default, user pools are configured to use Cognito's built in email capability, which will send emails
from no-reply@verificationemail.com
. If you want to use a custom email address you can configure
Cognito to send emails through Amazon SES, which is detailed below.
new UserPool(this, "myuserpool", new UserPoolProps {
Email = UserPoolEmail.WithCognito("support@myawesomeapp.com")
});
For typical production environments, the default email limit is below the required delivery volume. To enable a higher delivery volume, you can configure the UserPool to send emails through Amazon SES. To do so, follow the steps in the Cognito Developer Guide to verify an email address, move the account out of the SES sandbox, and grant Cognito email permissions via an authorization policy.
Once the SES setup is complete, the UserPool can be configured to use the SES email.
new UserPool(this, "myuserpool", new UserPoolProps {
Email = UserPoolEmail.WithSES(new UserPoolSESOptions {
FromEmail = "noreply@myawesomeapp.com",
FromName = "Awesome App",
ReplyTo = "support@myawesomeapp.com"
})
});
Sending emails through SES requires that SES be configured (as described above) in a valid SES region.
If the UserPool is being created in a different region, sesRegion
must be used to specify the correct SES region.
new UserPool(this, "myuserpool", new UserPoolProps {
Email = UserPoolEmail.WithSES(new UserPoolSESOptions {
SesRegion = "us-east-1",
FromEmail = "noreply@myawesomeapp.com",
FromName = "Awesome App",
ReplyTo = "support@myawesomeapp.com"
})
});
When sending emails from an SES verified domain, sesVerifiedDomain
can be used to specify the domain.
The email address does not need to be verified when sending emails from a verified domain, because the identity of the email configuration is can be determined from the domain alone.
new UserPool(this, "myuserpool", new UserPoolProps {
Email = UserPoolEmail.WithSES(new UserPoolSESOptions {
SesRegion = "us-east-1",
FromEmail = "noreply@myawesomeapp.com",
FromName = "Awesome App",
ReplyTo = "support@myawesomeapp.com",
SesVerifiedDomain = "myawesomeapp.com"
})
});
If fromName
does not comply RFC 5322 atom or quoted-string, it will be quoted or mime-encoded.
new UserPool(this, "myuserpool", new UserPoolProps {
Email = UserPoolEmail.WithSES(new UserPoolSESOptions {
FromEmail = "noreply@myawesomeapp.com",
FromName = "myname@mycompany.com"
})
});
Device Tracking
User pools can be configured to track devices that users have logged in to. Read more at Device Tracking
new UserPool(this, "myuserpool", new UserPoolProps {
// ...
DeviceTracking = new DeviceTracking {
ChallengeRequiredOnNewDevice = true,
DeviceOnlyRememberedOnUserPrompt = true
}
});
The default is to not track devices.
Lambda Triggers
User pools can be configured such that AWS Lambda functions can be triggered when certain user operations or actions occur, such as, sign up, user confirmation, sign in, etc. They can also be used to add custom authentication challenges, user migrations and custom verification messages. Learn more about triggers at User Pool Workflows with Triggers.
Lambda triggers can either be specified as part of the UserPool
initialization, or it can be added later, via methods
on the construct, as so -
var authChallengeFn = new Function(this, "authChallengeFn", new FunctionProps {
Runtime = Runtime.NODEJS_LATEST,
Handler = "index.handler",
Code = Code.FromAsset(Join(__dirname, "path/to/asset"))
});
var userpool = new UserPool(this, "myuserpool", new UserPoolProps {
// ...
LambdaTriggers = new UserPoolTriggers {
CreateAuthChallenge = authChallengeFn
}
});
userpool.AddTrigger(UserPoolOperation.USER_MIGRATION, new Function(this, "userMigrationFn", new FunctionProps {
Runtime = Runtime.NODEJS_LATEST,
Handler = "index.handler",
Code = Code.FromAsset(Join(__dirname, "path/to/asset"))
}));
Additionally, only the pre token generation Lambda trigger supports trigger events with lambda version V2.0:
UserPool userpool;
Function preTokenGenerationFn;
userpool.AddTrigger(UserPoolOperation.PRE_TOKEN_GENERATION_CONFIG, preTokenGenerationFn, LambdaVersion.V2_0);
The following table lists the set of triggers available, and their corresponding method to add it to the user pool. For more information on the function of these triggers and how to configure them, read User Pool Workflows with Triggers.
Trigger Permissions
The function.attachToRolePolicy()
API can be used to add additional IAM permissions to the lambda trigger
as necessary.
⚠️ Using the attachToRolePolicy
API to provide permissions to your user pool will result in a circular dependency. See aws/aws-cdk#7016.
Error message when running cdk synth
or cdk deploy
:
Circular dependency between resources: [pool056F3F7E, fnPostAuthFnCognitoA630A2B1, ...]
To work around the circular dependency issue, use the attachInlinePolicy()
API instead, as shown below.
Function postAuthFn;
var userpool = new UserPool(this, "myuserpool", new UserPoolProps {
LambdaTriggers = new UserPoolTriggers {
PostAuthentication = postAuthFn
}
});
// provide permissions to describe the user pool scoped to the ARN the user pool
postAuthFn.Role.AttachInlinePolicy(new Policy(this, "userpool-policy", new PolicyProps {
Statements = new [] { new PolicyStatement(new PolicyStatementProps {
Actions = new [] { "cognito-idp:DescribeUserPool" },
Resources = new [] { userpool.UserPoolArn }
}) }
}));
Importing User Pools
Any user pool that has been created outside of this stack, can be imported into the CDK app. Importing a user pool
allows for it to be used in other parts of the CDK app that reference an IUserPool
. However, imported user pools have
limited configurability. As a rule of thumb, none of the properties that are part of the
AWS::Cognito::UserPool
CloudFormation resource can be configured.
User pools can be imported either using their id via the UserPool.fromUserPoolId()
, or by using their ARN, via the
UserPool.fromUserPoolArn()
API.
var awesomePool = UserPool.FromUserPoolId(this, "awesome-user-pool", "us-east-1_oiuR12Abd");
var otherAwesomePool = UserPool.FromUserPoolArn(this, "other-awesome-user-pool", "arn:aws:cognito-idp:eu-west-1:123456789012:userpool/us-east-1_mtRyYQ14D");
Identity Providers
Users that are part of a user pool can sign in either directly through a user pool, or federate through a third-party identity provider. Once configured, the Cognito backend will take care of integrating with the third-party provider. Read more about Adding User Pool Sign-in Through a Third Party.
The following third-party identity providers are currently supported in the CDK -
The following code configures a user pool to federate with the third party provider, 'Login with Amazon'. The identity provider needs to be configured with a set of credentials that the Cognito backend can use to federate with the third-party identity provider.
var userpool = new UserPool(this, "Pool");
var provider = new UserPoolIdentityProviderAmazon(this, "Amazon", new UserPoolIdentityProviderAmazonProps {
ClientId = "amzn-client-id",
ClientSecret = "amzn-client-secret",
UserPool = userpool
});
Using Google identity provider is possible to use clientSecretValue with SecretValue from secrets manager.
var userpool = new UserPool(this, "Pool");
var secret = Secret.FromSecretAttributes(this, "CognitoClientSecret", new SecretAttributes {
SecretCompleteArn = "arn:aws:secretsmanager:xxx:xxx:secret:xxx-xxx"
}).SecretValue;
var provider = new UserPoolIdentityProviderGoogle(this, "Google", new UserPoolIdentityProviderGoogleProps {
ClientId = "amzn-client-id",
ClientSecretValue = secret,
UserPool = userpool
});
Using SAML identity provider is possible to use SAML metadata file content or SAML metadata file url.
var userpool = new UserPool(this, "Pool");
// specify the metadata as a file content
// specify the metadata as a file content
new UserPoolIdentityProviderSaml(this, "userpoolIdpFile", new UserPoolIdentityProviderSamlProps {
UserPool = userpool,
Metadata = UserPoolIdentityProviderSamlMetadata.File("my-file-contents"),
// Whether to require encrypted SAML assertions from IdP
EncryptedResponses = true,
// The signing algorithm for the SAML requests
RequestSigningAlgorithm = SigningAlgorithm.RSA_SHA256,
// Enable IdP initiated SAML auth flow
IdpInitiated = true
});
// specify the metadata as a URL
// specify the metadata as a URL
new UserPoolIdentityProviderSaml(this, "userpoolidpUrl", new UserPoolIdentityProviderSamlProps {
UserPool = userpool,
Metadata = UserPoolIdentityProviderSamlMetadata.Url("https://my-metadata-url.com")
});
Attribute mapping allows mapping attributes provided by the third-party identity providers to standard and custom attributes of the user pool. Learn more about Specifying Identity Provider Attribute Mappings for Your User Pool.
The following code shows how different attributes provided by 'Login With Amazon' can be mapped to standard and custom user pool attributes.
var userpool = new UserPool(this, "Pool");
new UserPoolIdentityProviderAmazon(this, "Amazon", new UserPoolIdentityProviderAmazonProps {
ClientId = "amzn-client-id",
ClientSecret = "amzn-client-secret",
UserPool = userpool,
AttributeMapping = new AttributeMapping {
Email = ProviderAttribute.AMAZON_EMAIL,
Website = ProviderAttribute.Other("url"), // use other() when an attribute is not pre-defined in the CDK
Custom = new Dictionary<string, ProviderAttribute> {
// custom user pool attributes go here
{ "uniqueId", ProviderAttribute.AMAZON_USER_ID }
}
}
});
App Clients
An app is an entity within a user pool that has permission to call unauthenticated APIs (APIs that do not have an authenticated user), such as APIs to register, sign in, and handle forgotten passwords. To call these APIs, you need an app client ID and an optional client secret. Read Configuring a User Pool App Client to learn more.
The following code creates an app client and retrieves the client id -
var pool = new UserPool(this, "pool");
var client = pool.AddClient("customer-app-client");
var clientId = client.UserPoolClientId;
Existing app clients can be imported into the CDK app using the UserPoolClient.fromUserPoolClientId()
API. For new
and imported user pools, clients can also be created via the UserPoolClient
constructor, as so -
var importedPool = UserPool.FromUserPoolId(this, "imported-pool", "us-east-1_oiuR12Abd");
new UserPoolClient(this, "customer-app-client", new UserPoolClientProps {
UserPool = importedPool
});
Clients can be configured with authentication flows. Authentication flows allow users on a client to be authenticated with a user pool. Cognito user pools provide several different types of authentication, such as, SRP (Secure Remote Password) authentication, username-and-password authentication, etc. Learn more about this at UserPool Authentication Flow.
The following code configures a client to use both SRP and username-and-password authentication -
var pool = new UserPool(this, "pool");
pool.AddClient("app-client", new UserPoolClientOptions {
AuthFlows = new AuthFlow {
UserPassword = true,
UserSrp = true
}
});
Custom authentication protocols can be configured by setting the custom
property under authFlow
and defining lambda
functions for the corresponding user pool triggers. Learn more at Custom Authentication
Flow.
Choice-based authentication can be configured by setting the user
property under authFlow
. This enables the
USER_AUTH
authentication flow. Learn more at Choice-based authentication.
In addition to these authentication mechanisms, Cognito user pools also support using OAuth 2.0 framework for authenticating users. User pool clients can be configured with OAuth 2.0 authorization flows and scopes. Learn more about the OAuth 2.0 authorization framework and Cognito user pool's implementation of OAuth2.0.
The following code configures an app client with the authorization code grant flow and registers the the app's welcome page as a callback (or redirect) URL. It also configures the access token scope to 'openid'. All of these concepts can be found in the OAuth 2.0 RFC.
var pool = new UserPool(this, "Pool");
pool.AddClient("app-client", new UserPoolClientOptions {
OAuth = new OAuthSettings {
Flows = new OAuthFlows {
AuthorizationCodeGrant = true
},
Scopes = new [] { OAuthScope.OPENID },
CallbackUrls = new [] { "https://my-app-domain.com/welcome" },
LogoutUrls = new [] { "https://my-app-domain.com/signin" }
}
});
To set a default redirect URI, use the defaultRedirectUri
property.
Its value must be present in the callbackUrls
list.
var pool = new UserPool(this, "Pool");
pool.AddClient("app-client", new UserPoolClientOptions {
OAuth = new OAuthSettings {
Flows = new OAuthFlows {
AuthorizationCodeGrant = true
},
Scopes = new [] { OAuthScope.OPENID },
DefaultRedirectUri = "https://my-app-domain.com/welcome",
CallbackUrls = new [] { "https://my-app-domain.com/welcome", "https://my-app-domain.com/hello" },
LogoutUrls = new [] { "https://my-app-domain.com/signin" }
}
});
An app client can be configured to prevent user existence errors. This instructs the Cognito authentication API to return generic authentication failure responses instead of an UserNotFoundException. By default, the flag is not set, which means the CloudFormation default (false) will be used. See the documentation for the full details on the behavior of this flag.
var pool = new UserPool(this, "Pool");
pool.AddClient("app-client", new UserPoolClientOptions {
PreventUserExistenceErrors = true
});
All identity providers created in the CDK app are automatically registered into the corresponding user pool. All app clients created in the CDK have all of the identity providers enabled by default. The 'Cognito' identity provider, that allows users to register and sign in directly with the Cognito user pool, is also enabled by default. Alternatively, the list of supported identity providers for a client can be explicitly specified -
var pool = new UserPool(this, "Pool");
pool.AddClient("app-client", new UserPoolClientOptions {
// ...
SupportedIdentityProviders = new [] { UserPoolClientIdentityProvider.AMAZON, UserPoolClientIdentityProvider.COGNITO }
});
If the identity provider and the app client are created in the same stack, specify the dependency between both constructs to make sure that the identity provider already exists when the app client will be created. The app client cannot handle the dependency to the identity provider automatically because the client does not have access to the provider's construct.
var pool = new UserPool(this, "Pool");
var provider = new UserPoolIdentityProviderAmazon(this, "Amazon", new UserPoolIdentityProviderAmazonProps {
UserPool = pool,
ClientId = "amzn-client-id",
ClientSecret = "amzn-client-secret"
});
var client = pool.AddClient("app-client", new UserPoolClientOptions {
// ...
SupportedIdentityProviders = new [] { UserPoolClientIdentityProvider.AMAZON }
});
client.Node.AddDependency(provider);
The property authSessionValidity
is the session token for each API request in the authentication flow.
Valid duration is from 3 to 15 minutes.
var pool = new UserPool(this, "Pool");
pool.AddClient("app-client", new UserPoolClientOptions {
// ...
AuthSessionValidity = Duration.Minutes(15)
});
In accordance with the OIDC open standard, Cognito user pool clients provide access tokens, ID tokens and refresh tokens. More information is available at Using Tokens with User Pools. The expiration time for these tokens can be configured as shown below.
var pool = new UserPool(this, "Pool");
pool.AddClient("app-client", new UserPoolClientOptions {
// ...
AccessTokenValidity = Duration.Minutes(60),
IdTokenValidity = Duration.Minutes(60),
RefreshTokenValidity = Duration.Days(30)
});
Clients can (and should) be allowed to read and write relevant user attributes only. Usually every client can be allowed to
read the given_name
attribute but not every client should be allowed to set the email_verified
attribute.
The same criteria applies for both standard and custom attributes, more info is available at
Attribute Permissions and Scopes.
The default behaviour is to allow read and write permissions on all attributes. The following code shows how this can be
configured for a client.
var pool = new UserPool(this, "Pool");
var clientWriteAttributes = (new ClientAttributes()).WithStandardAttributes(new StandardAttributesMask { Fullname = true, Email = true }).WithCustomAttributes("favoritePizza", "favoriteBeverage");
var clientReadAttributes = clientWriteAttributes.WithStandardAttributes(new StandardAttributesMask { EmailVerified = true }).WithCustomAttributes("pointsEarned");
pool.AddClient("app-client", new UserPoolClientOptions {
// ...
ReadAttributes = clientReadAttributes,
WriteAttributes = clientWriteAttributes
});
Token revocation can be configured to be able to revoke refresh tokens in app clients. By default, token revocation is enabled for new user pools. The property can be used to enable the token revocation in existing app clients or to change the default behavior.
var pool = new UserPool(this, "Pool");
pool.AddClient("app-client", new UserPoolClientOptions {
// ...
EnableTokenRevocation = true
});
User Pool clients can generate a client ID as well as a client secret, to support more advanced authentication workflows.
To create a client with an autogenerated client secret, pass the generateSecret: true
prop:
UserPool importedPool;
var userPoolClient = new UserPoolClient(this, "UserPoolClient", new UserPoolClientProps {
UserPool = importedPool,
GenerateSecret = true
});
// Allows you to pass the generated secret to other pieces of infrastructure
var secret = userPoolClient.UserPoolClientSecret;
If you set enablePropagateAdditionalUserContextData: true
, you can collect and pass
information about your user's session to Amazon Cognito advanced security
when you use the API to sign them up, sign them in, and reset their password.
UserPool importedPool;
var userPoolClient = new UserPoolClient(this, "UserPoolClient", new UserPoolClientProps {
UserPool = importedPool,
GenerateSecret = true,
EnablePropagateAdditionalUserContextData = true
});
See Adding user device and session data to API requests for more information.
Resource Servers
A resource server is a server for access-protected resources. It handles authenticated requests from an app that has an access token. See Defining Resource Servers for more information.
An application may choose to model custom permissions via OAuth. Resource Servers provide this capability via custom scopes that are attached to an app client. The following example sets up a resource server for the 'users' resource for two different app clients and configures the clients to use these scopes.
var pool = new UserPool(this, "Pool");
var readOnlyScope = new ResourceServerScope(new ResourceServerScopeProps { ScopeName = "read", ScopeDescription = "Read-only access" });
var fullAccessScope = new ResourceServerScope(new ResourceServerScopeProps { ScopeName = "*", ScopeDescription = "Full access" });
var userServer = pool.AddResourceServer("ResourceServer", new UserPoolResourceServerOptions {
Identifier = "users",
Scopes = new [] { readOnlyScope, fullAccessScope }
});
var readOnlyClient = pool.AddClient("read-only-client", new UserPoolClientOptions {
// ...
OAuth = new OAuthSettings {
// ...
Scopes = new [] { OAuthScope.ResourceServer(userServer, readOnlyScope) }
}
});
var fullAccessClient = pool.AddClient("full-access-client", new UserPoolClientOptions {
// ...
OAuth = new OAuthSettings {
// ...
Scopes = new [] { OAuthScope.ResourceServer(userServer, fullAccessScope) }
}
});
Domains
After setting up an app client, the address for the user pool's sign-up and sign-in webpages can be configured using domains. There are two ways to set up a domain - either the Amazon Cognito hosted domain can be chosen with an available domain prefix, or a custom domain name can be chosen. The custom domain must be one that is already owned, and whose certificate is registered in AWS Certificate Manager.
The following code sets up a user pool domain in Amazon Cognito hosted domain with the prefix 'my-awesome-app', and another domain with the custom domain 'user.myapp.com' -
var pool = new UserPool(this, "Pool");
pool.AddDomain("CognitoDomain", new UserPoolDomainOptions {
CognitoDomain = new CognitoDomainOptions {
DomainPrefix = "my-awesome-app"
}
});
var certificateArn = "arn:aws:acm:us-east-1:123456789012:certificate/11-3336f1-44483d-adc7-9cd375c5169d";
var domainCert = Certificate.FromCertificateArn(this, "domainCert", certificateArn);
pool.AddDomain("CustomDomain", new UserPoolDomainOptions {
CustomDomain = new CustomDomainOptions {
DomainName = "user.myapp.com",
Certificate = domainCert
}
});
Read more about Using the Amazon Cognito Domain and Using Your Own Domain.
You can use the managed login page provided by Amazon Cognito to sign in users. The managed login page has two versions: a classic version and a new version. You can switch between the two versions by using the managedLoginVersion
property.
var pool = new UserPool(this, "Pool");
// Use the new managed login page
pool.AddDomain("CognitoDomainWithBlandingDesignManagedLogin", new UserPoolDomainOptions {
CognitoDomain = new CognitoDomainOptions {
DomainPrefix = "blanding-design-ui"
},
ManagedLoginVersion = ManagedLoginVersion.NEWER_MANAGED_LOGIN
});
// Use the classic hosted UI
pool.AddDomain("DomainWithClassicHostedUi", new UserPoolDomainOptions {
CognitoDomain = new CognitoDomainOptions {
DomainPrefix = "classic-hosted-ui"
},
ManagedLoginVersion = ManagedLoginVersion.CLASSIC_HOSTED_UI
});
The signInUrl()
methods returns the fully qualified URL to the login page for the user pool. This page comes from the
hosted UI configured with Cognito. Learn more at Hosted UI with the Amazon Cognito
Console.
var userpool = new UserPool(this, "UserPool", new UserPoolProps { });
var client = userpool.AddClient("Client", new UserPoolClientOptions {
// ...
OAuth = new OAuthSettings {
Flows = new OAuthFlows {
ImplicitCodeGrant = true
},
CallbackUrls = new [] { "https://myapp.com/home", "https://myapp.com/users" }
}
});
var domain = userpool.AddDomain("Domain", new UserPoolDomainOptions { });
var signInUrl = domain.SignInUrl(client, new SignInUrlOptions {
RedirectUri = "https://myapp.com/home"
});
Existing domains can be imported into CDK apps using UserPoolDomain.fromDomainName()
API
var myUserPoolDomain = UserPoolDomain.FromDomainName(this, "my-user-pool-domain", "domain-name");
To get the domain name of the CloudFront distribution associated with the user pool domain, use cloudFrontEndpoint
method.
var userpool = new UserPool(this, "UserPool");
var domain = userpool.AddDomain("Domain", new UserPoolDomainOptions {
CognitoDomain = new CognitoDomainOptions {
DomainPrefix = "my-awesome-app"
}
});
new CfnOutput(this, "CloudFrontEndpoint", new CfnOutputProps {
Value = domain.CloudFrontEndpoint
});
Deletion protection
Deletion protection can be enabled on a user pool to prevent accidental deletion:
var userpool = new UserPool(this, "UserPool", new UserPoolProps {
// ...
DeletionProtection = true
});
By default deletion protection is disabled.
email_verified
Attribute Mapping
If you use a third-party identity provider, you can specify the email_verified
attribute in attributeMapping.
var userpool = new UserPool(this, "Pool");
new UserPoolIdentityProviderGoogle(this, "google", new UserPoolIdentityProviderGoogleProps {
UserPool = userpool,
ClientId = "google-client-id",
AttributeMapping = new AttributeMapping {
Email = ProviderAttribute.GOOGLE_EMAIL,
EmailVerified = ProviderAttribute.GOOGLE_EMAIL_VERIFIED
}
});
User Pool Group
Support for groups in Amazon Cognito user pools enables you to create and manage groups and add users to groups. Use groups to create collections of users to manage their permissions or to represent different types of users.
You can assign an AWS Identity and Access Management (IAM) role to a group to define the permissions for members of a group.
For more information, see Adding groups to a user pool.
UserPool userPool;
Role role;
new UserPoolGroup(this, "UserPoolGroup", new UserPoolGroupProps {
UserPool = userPool,
GroupName = "my-group-name",
Precedence = 1,
Role = role
});
// You can also add a group by using addGroup method.
userPool.AddGroup("AnotherUserPoolGroup", new UserPoolGroupOptions {
GroupName = "another-group-name"
});
Analytics Configuration
User pool clients can be configured with Amazon Pinpoint analytics to collect user activity metrics. This integration enables you to track user engagement and campaign effectiveness.
📝 Note: Amazon Pinpoint isn't available in all AWS Regions. For a list of available Regions, see Amazon Cognito and Amazon Pinpoint Region availability.
The following example shows how to configure analytics for a user pool client:
When specifying a Pinpoint application from the same account
If you specify the application
property, do not specify the applicationId
, externalId
, or roleArn
properties.
using Amazon.CDK.AWS.Pinpoint;
UserPool userPool;
CfnApp pinpointApp;
Role pinpointRole;
new UserPoolClient(this, "Client", new UserPoolClientProps {
UserPool = userPool,
Analytics = new AnalyticsConfiguration {
// Your Pinpoint project
Application = pinpointApp,
// Whether to include user data in analytics events
ShareUserData = true
}
});
When specifying a Pinpoint application from a different account
If you specify the applicationId
, externalId
, or roleArn
properties, do not specify the application
property.
(In this case, the applicationId
, externalId
, and roleArn
must all be specified.)
Those three attributes are for the cases when Cognito user pool need to be connected to Pinpoint app in other account.
using Amazon.CDK.AWS.Pinpoint;
UserPool userPool;
CfnApp pinpointApp;
Role pinpointRole;
new UserPoolClient(this, "Client", new UserPoolClientProps {
UserPool = userPool,
Analytics = new AnalyticsConfiguration {
// Your Pinpoint project ID
ApplicationId = pinpointApp.Ref,
// External ID for the IAM role
ExternalId = "sample-external-id",
// IAM role that Cognito can assume to publish to Pinpoint
Role = pinpointRole,
// Whether to include user data in analytics events
ShareUserData = true
}
});
Classes
Account |
How will a user be able to recover their account? |
Advanced |
(deprecated) The different ways in which a user pool's Advanced Security Mode can be configured. |
Allowed |
The types of authentication that you want to allow for users' first authentication prompt. |
Analytics |
The settings for Amazon Pinpoint analytics configuration. |
Attribute |
The mapping of user pool attributes to the attributes provided by the identity providers. |
Auth |
Types of authentication flow. |
Auto |
Attributes that can be automatically verified for users in a user pool. |
Base |
Options to customize the behaviour of |
Boolean |
The Boolean custom attribute type. |
Cfn |
The |
Cfn |
|
Cfn |
|
Cfn |
|
Cfn |
A list of the identity pool principal tag assignments for attributes for access control. |
Cfn |
Properties for defining a |
Cfn |
Properties for defining a |
Cfn |
The |
Cfn |
Defines how to map a claim to a role ARN. |
Cfn |
One of a set of |
Cfn |
|
Cfn |
Properties for defining a |
Cfn |
Sets up or modifies the logging configuration of a user pool. |
Cfn |
Configuration for the CloudWatch log group destination of user pool detailed activity logging, or of user activity log export with advanced security features. |
Cfn |
Configuration for the Amazon Data Firehose stream destination of user activity log export with threat protection. |
Cfn |
The configuration of user event logs to an external AWS service like Amazon Data Firehose, Amazon S3, or Amazon CloudWatch Logs. |
Cfn |
Configuration for the Amazon S3 bucket destination of user activity log export with threat protection. |
Cfn |
Properties for defining a |
Cfn |
Creates a new set of branding settings for a user pool style and associates it with an app client. |
Cfn |
An image file from a managed login branding style in a user pool. |
Cfn |
Properties for defining a |
Cfn |
The |
Cfn |
The available verified method a user can use to recover their password when they call |
Cfn |
The settings for administrator creation of users in a user pool. |
Cfn |
Threat protection configuration options for additional authentication types in your user pool, including custom authentication. |
Cfn |
The configuration of a custom email sender Lambda trigger. |
Cfn |
The configuration of a custom SMS sender Lambda trigger. |
Cfn |
The device-remembering configuration for a user pool. |
Cfn |
The email configuration of your user pool. |
Cfn |
The template for the welcome message to new users. |
Cfn |
A collection of user pool Lambda triggers. |
Cfn |
The minimum and maximum values of an attribute that is of the number type, for example |
Cfn |
The password policy settings for a user pool, including complexity, history, and length requirements. |
Cfn |
A list of user pool policies. |
Cfn |
The properties of a pre token generation Lambda trigger. |
Cfn |
A recovery option for a user. |
Cfn |
A list of the user attributes and their properties in your user pool. |
Cfn |
The policy for allowed types of authentication in a user pool. |
Cfn |
User pool configuration for delivery of SMS messages with Amazon Simple Notification Service. |
Cfn |
The minimum and maximum length values of an attribute that is of the string type, for example |
Cfn |
The settings for updates to user attributes. |
Cfn |
Case sensitivity of the username input for the selected sign-in option. |
Cfn |
User pool add-ons. |
Cfn |
The template for the verification message that your user pool delivers to users who set an email address or phone number attribute. |
Cfn |
The |
Cfn |
The settings for Amazon Pinpoint analytics configuration. |
Cfn |
The units that validity times are represented in. |
Cfn |
Properties for defining a |
Cfn |
The AWS::Cognito::UserPoolDomain resource creates a new domain for a user pool. |
Cfn |
The configuration for a hosted UI custom domain. |
Cfn |
Properties for defining a |
Cfn |
A user pool group. |
Cfn |
Properties for defining a |
Cfn |
The |
Cfn |
Properties for defining a |
Cfn |
Properties for defining a |
Cfn |
The |
Cfn |
One custom scope associated with a user pool resource server. |
Cfn |
Properties for defining a |
Cfn |
The |
Cfn |
A list of account-takeover actions for each level of risk that Amazon Cognito might assess with advanced security features. |
Cfn |
The automated response to a risk level for adaptive authentication in full-function, or |
Cfn |
The settings for automated responses and notification templates for adaptive authentication with advanced security features. |
Cfn |
Settings for user pool actions when Amazon Cognito detects compromised credentials with advanced security features in full-function |
Cfn |
Settings for compromised-credentials actions and authentication-event sources with advanced security features in full-function |
Cfn |
The configuration for Amazon SES email messages that advanced security features sends to a user when your adaptive authentication automated response has a Notify action. |
Cfn |
The template for email messages that advanced security features sends to a user when your threat protection automated response has a Notify action. |
Cfn |
Exceptions to the risk evaluation configuration, including always-allow and always-block IP address ranges. |
Cfn |
Properties for defining a |
Cfn |
A container for the UI customization information for the hosted UI in a user pool. |
Cfn |
Properties for defining a |
Cfn |
The |
Cfn |
The name and value of a user attribute. |
Cfn |
Properties for defining a |
Cfn |
Adds a user to a group. |
Cfn |
Properties for defining a |
Client |
A set of attributes, useful to set Read and Write attributes. |
Cognito |
Options while specifying a cognito prefix domain. |
Custom |
Configuration that will be fed into CloudFormation for any custom attribute type. |
Custom |
Constraints that can be applied to a custom attribute of any type. |
Custom |
Options while specifying custom domain. |
Custom |
The Type of Threat Protection Enabled for Custom Authentication. |
Date |
The DateTime custom attribute type. |
Device |
Device tracking settings. |
Email |
Email settings for the user pool. |
Feature |
The user pool feature plan, or tier. |
Keep |
Attributes that will be kept until the user verifies the changed attribute. |
Lambda |
The user pool trigger version of the request that Amazon Cognito sends to your Lambda function. |
Managed |
The branding version of managed login for the domain. |
Mfa | The different ways in which a user pool's MFA enforcement can be configured. |
Mfa |
The different ways in which a user pool can obtain their MFA token for sign in. |
Number |
The Number custom attribute type. |
Number |
Constraints that can be applied to a custom attribute of number type. |
Number |
Props for NumberAttr. |
OAuth |
Types of OAuth grant flows. |
OAuth |
OAuth scopes that are allowed with this client. |
OAuth |
OAuth settings to configure the interaction between the app and this client. |
Oidc |
The method to use to request attributes. |
Oidc |
OpenID Connect endpoints. |
Passkey |
The user-pool treatment for MFA with a passkey. |
Password |
Password policy for User Pools. |
Provider |
An attribute available from a third party identity provider. |
Resource |
A scope for ResourceServer. |
Resource |
Props to initialize ResourceServerScope. |
Sign |
The different ways in which users of this pool can sign up or sign in. |
Signing |
Signing algorithms for SAML requests. |
Sign |
Sign-in policy for User Pools. |
Sign |
Options to customize the behaviour of |
Standard |
Standard attribute that can be marked as required or mutable. |
Standard |
The set of standard attributes that can be marked as required or mutable. |
Standard |
This interface contains standard attributes recognized by Cognito from https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html including built-in attributes |
Standard |
The Type of Threat Protection Enabled for Standard Authentication. |
String |
The String custom attribute type. |
String |
Constraints that can be applied to a custom attribute of string type. |
String |
Props for constructing a StringAttr. |
User |
User pool configuration when administrators sign users up. |
User |
Define a Cognito User Pool. |
User |
Define a UserPool App Client. |
User |
Identity providers supported by the UserPoolClient. |
User |
Options to create a UserPoolClient. |
User |
Properties for the UserPoolClient construct. |
User |
Define a user pool domain. |
User |
Options to create a UserPoolDomain. |
User |
Props for UserPoolDomain construct. |
User |
Configure how Cognito sends emails. |
User |
Result of binding email settings with a user pool. |
User |
Define a user pool group. |
User |
Options to create a UserPoolGroup. |
User |
Props for UserPoolGroup construct. |
User |
User pool third-party identity providers. |
User |
Represents an identity provider that integrates with Login with Amazon. |
User |
Properties to initialize UserPoolAmazonIdentityProvider. |
User |
Represents an identity provider that integrates with Apple. |
User |
Properties to initialize UserPoolAppleIdentityProvider. |
User |
Represents an identity provider that integrates with Facebook Login. |
User |
Properties to initialize UserPoolFacebookIdentityProvider. |
User |
Represents an identity provider that integrates with Google. |
User |
Properties to initialize UserPoolGoogleIdentityProvider. |
User |
Represents an identity provider that integrates with OpenID Connect. |
User |
Properties to initialize UserPoolIdentityProviderOidc. |
User |
Properties to create a new instance of UserPoolIdentityProvider. |
User |
Represents an identity provider that integrates with SAML. |
User |
Metadata for a SAML user pool identity provider. |
User |
Metadata types that can be used for a SAML user pool identity provider. |
User |
Properties to initialize UserPoolIdentityProviderSaml. |
User |
User pool operations to which lambda triggers can be attached. |
User |
Props for the UserPool construct. |
User |
Defines a User Pool OAuth2.0 Resource Server. |
User |
Options to create a UserPoolResourceServer. |
User |
Properties for the UserPoolResourceServer construct. |
User |
Configuration for Cognito sending emails via Amazon SES. |
User |
Triggers for a user pool. |
User |
User pool configuration for user self sign up. |
Verification |
The email verification style. |
Interfaces
Cfn |
|
Cfn |
|
Cfn |
|
Cfn |
Defines how to map a claim to a role ARN. |
Cfn |
One of a set of |
Cfn |
|
Cfn |
Configuration for the CloudWatch log group destination of user pool detailed activity logging, or of user activity log export with advanced security features. |
Cfn |
Configuration for the Amazon Data Firehose stream destination of user activity log export with threat protection. |
Cfn |
The configuration of user event logs to an external AWS service like Amazon Data Firehose, Amazon S3, or Amazon CloudWatch Logs. |
Cfn |
Configuration for the Amazon S3 bucket destination of user activity log export with threat protection. |
Cfn |
An image file from a managed login branding style in a user pool. |
Cfn |
The available verified method a user can use to recover their password when they call |
Cfn |
The settings for administrator creation of users in a user pool. |
Cfn |
Threat protection configuration options for additional authentication types in your user pool, including custom authentication. |
Cfn |
The configuration of a custom email sender Lambda trigger. |
Cfn |
The configuration of a custom SMS sender Lambda trigger. |
Cfn |
The device-remembering configuration for a user pool. |
Cfn |
The email configuration of your user pool. |
Cfn |
The template for the welcome message to new users. |
Cfn |
A collection of user pool Lambda triggers. |
Cfn |
The minimum and maximum values of an attribute that is of the number type, for example |
Cfn |
The password policy settings for a user pool, including complexity, history, and length requirements. |
Cfn |
A list of user pool policies. |
Cfn |
The properties of a pre token generation Lambda trigger. |
Cfn |
A recovery option for a user. |
Cfn |
A list of the user attributes and their properties in your user pool. |
Cfn |
The policy for allowed types of authentication in a user pool. |
Cfn |
User pool configuration for delivery of SMS messages with Amazon Simple Notification Service. |
Cfn |
The minimum and maximum length values of an attribute that is of the string type, for example |
Cfn |
The settings for updates to user attributes. |
Cfn |
Case sensitivity of the username input for the selected sign-in option. |
Cfn |
User pool add-ons. |
Cfn |
The template for the verification message that your user pool delivers to users who set an email address or phone number attribute. |
Cfn |
The settings for Amazon Pinpoint analytics configuration. |
Cfn |
The units that validity times are represented in. |
Cfn |
The configuration for a hosted UI custom domain. |
Cfn |
One custom scope associated with a user pool resource server. |
Cfn |
A list of account-takeover actions for each level of risk that Amazon Cognito might assess with advanced security features. |
Cfn |
The automated response to a risk level for adaptive authentication in full-function, or |
Cfn |
The settings for automated responses and notification templates for adaptive authentication with advanced security features. |
Cfn |
Settings for user pool actions when Amazon Cognito detects compromised credentials with advanced security features in full-function |
Cfn |
Settings for compromised-credentials actions and authentication-event sources with advanced security features in full-function |
Cfn |
The configuration for Amazon SES email messages that advanced security features sends to a user when your adaptive authentication automated response has a Notify action. |
Cfn |
The template for email messages that advanced security features sends to a user when your threat protection automated response has a Notify action. |
Cfn |
Exceptions to the risk evaluation configuration, including always-allow and always-block IP address ranges. |
Cfn |
The name and value of a user attribute. |
IAllowed |
The types of authentication that you want to allow for users' first authentication prompt. |
IAnalytics |
The settings for Amazon Pinpoint analytics configuration. |
IAttribute |
The mapping of user pool attributes to the attributes provided by the identity providers. |
IAuth |
Types of authentication flow. |
IAuto |
Attributes that can be automatically verified for users in a user pool. |
IBase |
Options to customize the behaviour of |
ICfn |
Properties for defining a |
ICfn |
Properties for defining a |
ICfn |
Properties for defining a |
ICfn |
Properties for defining a |
ICfn |
Properties for defining a |
ICfn |
Properties for defining a |
ICfn |
Properties for defining a |
ICfn |
Properties for defining a |
ICfn |
Properties for defining a |
ICfn |
Properties for defining a |
ICfn |
Properties for defining a |
ICfn |
Properties for defining a |
ICfn |
Properties for defining a |
ICfn |
Properties for defining a |
ICfn |
Properties for defining a |
ICognito |
Options while specifying a cognito prefix domain. |
ICustom |
Represents a custom attribute type. |
ICustom |
Configuration that will be fed into CloudFormation for any custom attribute type. |
ICustom |
Constraints that can be applied to a custom attribute of any type. |
ICustom |
Options while specifying custom domain. |
IDevice |
Device tracking settings. |
IEmail |
Email settings for the user pool. |
IKeep |
Attributes that will be kept until the user verifies the changed attribute. |
IMfa |
The different ways in which a user pool can obtain their MFA token for sign in. |
INumber |
Constraints that can be applied to a custom attribute of number type. |
INumber |
Props for NumberAttr. |
IOAuth |
Types of OAuth grant flows. |
IOAuth |
OAuth settings to configure the interaction between the app and this client. |
IOidc |
OpenID Connect endpoints. |
IPassword |
Password policy for User Pools. |
IResource |
Props to initialize ResourceServerScope. |
ISign |
The different ways in which users of this pool can sign up or sign in. |
ISign |
Sign-in policy for User Pools. |
ISign |
Options to customize the behaviour of |
IStandard |
Standard attribute that can be marked as required or mutable. |
IStandard |
The set of standard attributes that can be marked as required or mutable. |
IStandard |
This interface contains standard attributes recognized by Cognito from https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html including built-in attributes |
IString |
Constraints that can be applied to a custom attribute of string type. |
IString |
Props for constructing a StringAttr. |
IUser |
User pool configuration when administrators sign users up. |
IUser |
Represents a Cognito UserPool. |
IUser |
Represents a Cognito user pool client. |
IUser |
Options to create a UserPoolClient. |
IUser |
Properties for the UserPoolClient construct. |
IUser |
Represents a user pool domain. |
IUser |
Options to create a UserPoolDomain. |
IUser |
Props for UserPoolDomain construct. |
IUser |
Result of binding email settings with a user pool. |
IUser |
Represents a user pool group. |
IUser |
Options to create a UserPoolGroup. |
IUser |
Props for UserPoolGroup construct. |
IUser |
Represents a UserPoolIdentityProvider. |
IUser |
Properties to initialize UserPoolAmazonIdentityProvider. |
IUser |
Properties to initialize UserPoolAppleIdentityProvider. |
IUser |
Properties to initialize UserPoolFacebookIdentityProvider. |
IUser |
Properties to initialize UserPoolGoogleIdentityProvider. |
IUser |
Properties to initialize UserPoolIdentityProviderOidc. |
IUser |
Properties to create a new instance of UserPoolIdentityProvider. |
IUser |
Properties to initialize UserPoolIdentityProviderSaml. |
IUser |
Props for the UserPool construct. |
IUser |
Represents a Cognito user pool resource server. |
IUser |
Options to create a UserPoolResourceServer. |
IUser |
Properties for the UserPoolResourceServer construct. |
IUser |
Configuration for Cognito sending emails via Amazon SES. |
IUser |
Triggers for a user pool. |
IUser |
User pool configuration for user self sign up. |