Skip to content

Commit 1c98881

Browse files
feat(cognito): add analyticsConfiguration to UserPoolClient (#32862)
### 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*
1 parent 51e671f commit 1c98881

15 files changed

+32606
-1
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-analytics.js.snapshot/IntegUserPoolClientAnalytics.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
{
2+
"Resources": {
3+
"PinpointApp": {
4+
"Type": "AWS::Pinpoint::App",
5+
"Properties": {
6+
"Name": "SamplePinpointApp"
7+
},
8+
"UpdateReplacePolicy": "Delete",
9+
"DeletionPolicy": "Delete"
10+
},
11+
"PoolD3F588B8": {
12+
"Type": "AWS::Cognito::UserPool",
13+
"Properties": {
14+
"AccountRecoverySetting": {
15+
"RecoveryMechanisms": [
16+
{
17+
"Name": "verified_phone_number",
18+
"Priority": 1
19+
},
20+
{
21+
"Name": "verified_email",
22+
"Priority": 2
23+
}
24+
]
25+
},
26+
"AdminCreateUserConfig": {
27+
"AllowAdminCreateUserOnly": true
28+
},
29+
"EmailVerificationMessage": "The verification code to your new account is {####}",
30+
"EmailVerificationSubject": "Verify your new account",
31+
"SmsVerificationMessage": "The verification code to your new account is {####}",
32+
"VerificationMessageTemplate": {
33+
"DefaultEmailOption": "CONFIRM_WITH_CODE",
34+
"EmailMessage": "The verification code to your new account is {####}",
35+
"EmailSubject": "Verify your new account",
36+
"SmsMessage": "The verification code to your new account is {####}"
37+
}
38+
},
39+
"UpdateReplacePolicy": "Delete",
40+
"DeletionPolicy": "Delete"
41+
},
42+
"PoolClient8A3E5EB7": {
43+
"Type": "AWS::Cognito::UserPoolClient",
44+
"Properties": {
45+
"AllowedOAuthFlows": [
46+
"implicit",
47+
"code"
48+
],
49+
"AllowedOAuthFlowsUserPoolClient": true,
50+
"AllowedOAuthScopes": [
51+
"profile",
52+
"phone",
53+
"email",
54+
"openid",
55+
"aws.cognito.signin.user.admin"
56+
],
57+
"AnalyticsConfiguration": {
58+
"ApplicationArn": {
59+
"Fn::GetAtt": [
60+
"PinpointApp",
61+
"Arn"
62+
]
63+
}
64+
},
65+
"CallbackURLs": [
66+
"https://example.com"
67+
],
68+
"GenerateSecret": true,
69+
"SupportedIdentityProviders": [
70+
"COGNITO"
71+
],
72+
"UserPoolId": {
73+
"Ref": "PoolD3F588B8"
74+
}
75+
}
76+
}
77+
},
78+
"Outputs": {
79+
"ExportsOutputRefPoolD3F588B86FF122B2": {
80+
"Value": {
81+
"Ref": "PoolD3F588B8"
82+
},
83+
"Export": {
84+
"Name": "IntegUserPoolClientAnalytics:ExportsOutputRefPoolD3F588B86FF122B2"
85+
}
86+
},
87+
"ExportsOutputRefPoolClient8A3E5EB779A339F2": {
88+
"Value": {
89+
"Ref": "PoolClient8A3E5EB7"
90+
},
91+
"Export": {
92+
"Name": "IntegUserPoolClientAnalytics:ExportsOutputRefPoolClient8A3E5EB779A339F2"
93+
}
94+
}
95+
},
96+
"Parameters": {
97+
"BootstrapVersion": {
98+
"Type": "AWS::SSM::Parameter::Value<String>",
99+
"Default": "/cdk-bootstrap/hnb659fds/version",
100+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
101+
}
102+
},
103+
"Rules": {
104+
"CheckBootstrapVersion": {
105+
"Assertions": [
106+
{
107+
"Assert": {
108+
"Fn::Not": [
109+
{
110+
"Fn::Contains": [
111+
[
112+
"1",
113+
"2",
114+
"3",
115+
"4",
116+
"5"
117+
],
118+
{
119+
"Ref": "BootstrapVersion"
120+
}
121+
]
122+
}
123+
]
124+
},
125+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
126+
}
127+
]
128+
}
129+
}
130+
}

packages/@aws-cdk-testing/framework-integ/test/aws-cognito/test/integ.user-pool-client-analytics.js.snapshot/IntegUserPoolClientAnalytics2.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
{
2+
"Resources": {
3+
"PinpointApp": {
4+
"Type": "AWS::Pinpoint::App",
5+
"Properties": {
6+
"Name": "SamplePinpointApp"
7+
},
8+
"UpdateReplacePolicy": "Delete",
9+
"DeletionPolicy": "Delete"
10+
},
11+
"Role1ABCC5F0": {
12+
"Type": "AWS::IAM::Role",
13+
"Properties": {
14+
"AssumeRolePolicyDocument": {
15+
"Statement": [
16+
{
17+
"Action": "sts:AssumeRole",
18+
"Effect": "Allow",
19+
"Principal": {
20+
"Service": "cognito-idp.amazonaws.com"
21+
}
22+
}
23+
],
24+
"Version": "2012-10-17"
25+
}
26+
}
27+
},
28+
"RoleDefaultPolicy5FFB7DAB": {
29+
"Type": "AWS::IAM::Policy",
30+
"Properties": {
31+
"PolicyDocument": {
32+
"Statement": [
33+
{
34+
"Action": "mobiletargeting:*",
35+
"Effect": "Allow",
36+
"Resource": "*"
37+
}
38+
],
39+
"Version": "2012-10-17"
40+
},
41+
"PolicyName": "RoleDefaultPolicy5FFB7DAB",
42+
"Roles": [
43+
{
44+
"Ref": "Role1ABCC5F0"
45+
}
46+
]
47+
}
48+
},
49+
"PoolD3F588B8": {
50+
"Type": "AWS::Cognito::UserPool",
51+
"Properties": {
52+
"AccountRecoverySetting": {
53+
"RecoveryMechanisms": [
54+
{
55+
"Name": "verified_phone_number",
56+
"Priority": 1
57+
},
58+
{
59+
"Name": "verified_email",
60+
"Priority": 2
61+
}
62+
]
63+
},
64+
"AdminCreateUserConfig": {
65+
"AllowAdminCreateUserOnly": true
66+
},
67+
"EmailVerificationMessage": "The verification code to your new account is {####}",
68+
"EmailVerificationSubject": "Verify your new account",
69+
"SmsVerificationMessage": "The verification code to your new account is {####}",
70+
"VerificationMessageTemplate": {
71+
"DefaultEmailOption": "CONFIRM_WITH_CODE",
72+
"EmailMessage": "The verification code to your new account is {####}",
73+
"EmailSubject": "Verify your new account",
74+
"SmsMessage": "The verification code to your new account is {####}"
75+
}
76+
},
77+
"UpdateReplacePolicy": "Delete",
78+
"DeletionPolicy": "Delete"
79+
},
80+
"Poolclient49CF16E5": {
81+
"Type": "AWS::Cognito::UserPoolClient",
82+
"Properties": {
83+
"AllowedOAuthFlows": [
84+
"implicit",
85+
"code"
86+
],
87+
"AllowedOAuthFlowsUserPoolClient": true,
88+
"AllowedOAuthScopes": [
89+
"profile",
90+
"phone",
91+
"email",
92+
"openid",
93+
"aws.cognito.signin.user.admin"
94+
],
95+
"AnalyticsConfiguration": {
96+
"ApplicationId": {
97+
"Ref": "PinpointApp"
98+
},
99+
"ExternalId": {
100+
"Fn::GetAtt": [
101+
"Role1ABCC5F0",
102+
"RoleId"
103+
]
104+
},
105+
"RoleArn": {
106+
"Fn::GetAtt": [
107+
"Role1ABCC5F0",
108+
"Arn"
109+
]
110+
}
111+
},
112+
"CallbackURLs": [
113+
"https://example.com"
114+
],
115+
"GenerateSecret": true,
116+
"SupportedIdentityProviders": [
117+
"COGNITO"
118+
],
119+
"UserPoolId": {
120+
"Ref": "PoolD3F588B8"
121+
}
122+
}
123+
}
124+
},
125+
"Outputs": {
126+
"ExportsOutputRefPoolD3F588B86FF122B2": {
127+
"Value": {
128+
"Ref": "PoolD3F588B8"
129+
},
130+
"Export": {
131+
"Name": "IntegUserPoolClientAnalytics2:ExportsOutputRefPoolD3F588B86FF122B2"
132+
}
133+
},
134+
"ExportsOutputRefPoolclient49CF16E539FEBCFA": {
135+
"Value": {
136+
"Ref": "Poolclient49CF16E5"
137+
},
138+
"Export": {
139+
"Name": "IntegUserPoolClientAnalytics2:ExportsOutputRefPoolclient49CF16E539FEBCFA"
140+
}
141+
}
142+
},
143+
"Parameters": {
144+
"BootstrapVersion": {
145+
"Type": "AWS::SSM::Parameter::Value<String>",
146+
"Default": "/cdk-bootstrap/hnb659fds/version",
147+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
148+
}
149+
},
150+
"Rules": {
151+
"CheckBootstrapVersion": {
152+
"Assertions": [
153+
{
154+
"Assert": {
155+
"Fn::Not": [
156+
{
157+
"Fn::Contains": [
158+
[
159+
"1",
160+
"2",
161+
"3",
162+
"4",
163+
"5"
164+
],
165+
{
166+
"Ref": "BootstrapVersion"
167+
}
168+
]
169+
}
170+
]
171+
},
172+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
173+
}
174+
]
175+
}
176+
}
177+
}

0 commit comments

Comments
 (0)