Skip to content

Commit

Permalink
feat(cognito): add analyticsConfiguration to UserPoolClient (#32862)
Browse files Browse the repository at this point in the history
### Issue # (if applicable)

Closes #32837 

### Reason for this change

UserPoolClient in Cognito did not support the `analyticsConfiguration` property.

### Description of changes

- add `analytics` property to UserPoolClientProps(interface)
- add `validationAnalytics` method to UserPoolClient(Class / L2 Construct)

### Description of how you validated changes

Added both unit and integration tests.

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
ren-yamanashi authored Feb 7, 2025
1 parent 51e671f commit 1c98881
Show file tree
Hide file tree
Showing 15 changed files with 32,606 additions and 1 deletion.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"Resources": {
"PinpointApp": {
"Type": "AWS::Pinpoint::App",
"Properties": {
"Name": "SamplePinpointApp"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"PoolD3F588B8": {
"Type": "AWS::Cognito::UserPool",
"Properties": {
"AccountRecoverySetting": {
"RecoveryMechanisms": [
{
"Name": "verified_phone_number",
"Priority": 1
},
{
"Name": "verified_email",
"Priority": 2
}
]
},
"AdminCreateUserConfig": {
"AllowAdminCreateUserOnly": true
},
"EmailVerificationMessage": "The verification code to your new account is {####}",
"EmailVerificationSubject": "Verify your new account",
"SmsVerificationMessage": "The verification code to your new account is {####}",
"VerificationMessageTemplate": {
"DefaultEmailOption": "CONFIRM_WITH_CODE",
"EmailMessage": "The verification code to your new account is {####}",
"EmailSubject": "Verify your new account",
"SmsMessage": "The verification code to your new account is {####}"
}
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"PoolClient8A3E5EB7": {
"Type": "AWS::Cognito::UserPoolClient",
"Properties": {
"AllowedOAuthFlows": [
"implicit",
"code"
],
"AllowedOAuthFlowsUserPoolClient": true,
"AllowedOAuthScopes": [
"profile",
"phone",
"email",
"openid",
"aws.cognito.signin.user.admin"
],
"AnalyticsConfiguration": {
"ApplicationArn": {
"Fn::GetAtt": [
"PinpointApp",
"Arn"
]
}
},
"CallbackURLs": [
"https://example.com"
],
"GenerateSecret": true,
"SupportedIdentityProviders": [
"COGNITO"
],
"UserPoolId": {
"Ref": "PoolD3F588B8"
}
}
}
},
"Outputs": {
"ExportsOutputRefPoolD3F588B86FF122B2": {
"Value": {
"Ref": "PoolD3F588B8"
},
"Export": {
"Name": "IntegUserPoolClientAnalytics:ExportsOutputRefPoolD3F588B86FF122B2"
}
},
"ExportsOutputRefPoolClient8A3E5EB779A339F2": {
"Value": {
"Ref": "PoolClient8A3E5EB7"
},
"Export": {
"Name": "IntegUserPoolClientAnalytics:ExportsOutputRefPoolClient8A3E5EB779A339F2"
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
{
"Resources": {
"PinpointApp": {
"Type": "AWS::Pinpoint::App",
"Properties": {
"Name": "SamplePinpointApp"
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"Role1ABCC5F0": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "cognito-idp.amazonaws.com"
}
}
],
"Version": "2012-10-17"
}
}
},
"RoleDefaultPolicy5FFB7DAB": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": "mobiletargeting:*",
"Effect": "Allow",
"Resource": "*"
}
],
"Version": "2012-10-17"
},
"PolicyName": "RoleDefaultPolicy5FFB7DAB",
"Roles": [
{
"Ref": "Role1ABCC5F0"
}
]
}
},
"PoolD3F588B8": {
"Type": "AWS::Cognito::UserPool",
"Properties": {
"AccountRecoverySetting": {
"RecoveryMechanisms": [
{
"Name": "verified_phone_number",
"Priority": 1
},
{
"Name": "verified_email",
"Priority": 2
}
]
},
"AdminCreateUserConfig": {
"AllowAdminCreateUserOnly": true
},
"EmailVerificationMessage": "The verification code to your new account is {####}",
"EmailVerificationSubject": "Verify your new account",
"SmsVerificationMessage": "The verification code to your new account is {####}",
"VerificationMessageTemplate": {
"DefaultEmailOption": "CONFIRM_WITH_CODE",
"EmailMessage": "The verification code to your new account is {####}",
"EmailSubject": "Verify your new account",
"SmsMessage": "The verification code to your new account is {####}"
}
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"Poolclient49CF16E5": {
"Type": "AWS::Cognito::UserPoolClient",
"Properties": {
"AllowedOAuthFlows": [
"implicit",
"code"
],
"AllowedOAuthFlowsUserPoolClient": true,
"AllowedOAuthScopes": [
"profile",
"phone",
"email",
"openid",
"aws.cognito.signin.user.admin"
],
"AnalyticsConfiguration": {
"ApplicationId": {
"Ref": "PinpointApp"
},
"ExternalId": {
"Fn::GetAtt": [
"Role1ABCC5F0",
"RoleId"
]
},
"RoleArn": {
"Fn::GetAtt": [
"Role1ABCC5F0",
"Arn"
]
}
},
"CallbackURLs": [
"https://example.com"
],
"GenerateSecret": true,
"SupportedIdentityProviders": [
"COGNITO"
],
"UserPoolId": {
"Ref": "PoolD3F588B8"
}
}
}
},
"Outputs": {
"ExportsOutputRefPoolD3F588B86FF122B2": {
"Value": {
"Ref": "PoolD3F588B8"
},
"Export": {
"Name": "IntegUserPoolClientAnalytics2:ExportsOutputRefPoolD3F588B86FF122B2"
}
},
"ExportsOutputRefPoolclient49CF16E539FEBCFA": {
"Value": {
"Ref": "Poolclient49CF16E5"
},
"Export": {
"Name": "IntegUserPoolClientAnalytics2:ExportsOutputRefPoolclient49CF16E539FEBCFA"
}
}
},
"Parameters": {
"BootstrapVersion": {
"Type": "AWS::SSM::Parameter::Value<String>",
"Default": "/cdk-bootstrap/hnb659fds/version",
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
}
},
"Rules": {
"CheckBootstrapVersion": {
"Assertions": [
{
"Assert": {
"Fn::Not": [
{
"Fn::Contains": [
[
"1",
"2",
"3",
"4",
"5"
],
{
"Ref": "BootstrapVersion"
}
]
}
]
},
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
}
]
}
}
}
Loading

0 comments on commit 1c98881

Please sign in to comment.