2
2
3
3
package events
4
4
5
- // CognitoEvent contains data from an event sent from AWS Cognito Sync
5
+ // CognitoEvent contains data from an event sent from Amazon Cognito Sync
6
6
type CognitoEvent struct {
7
7
DatasetName string `json:"datasetName"`
8
8
DatasetRecords map [string ]CognitoDatasetRecord `json:"datasetRecords"`
@@ -13,54 +13,62 @@ type CognitoEvent struct {
13
13
Version int `json:"version"`
14
14
}
15
15
16
- // CognitoDatasetRecord represents a record from an AWS Cognito Sync event
16
+ // CognitoDatasetRecord represents a record from an Amazon Cognito Sync event
17
17
type CognitoDatasetRecord struct {
18
18
NewValue string `json:"newValue"`
19
19
OldValue string `json:"oldValue"`
20
20
Op string `json:"op"`
21
21
}
22
22
23
- // CognitoEventUserPoolsPreSignup is sent by AWS Cognito User Pools when a user attempts to register
23
+ // CognitoEventUserPoolsPreSignup is sent by Amazon Cognito User Pools when a user attempts to register
24
24
// (sign up), allowing a Lambda to perform custom validation to accept or deny the registration request
25
25
type CognitoEventUserPoolsPreSignup struct {
26
26
CognitoEventUserPoolsHeader
27
27
Request CognitoEventUserPoolsPreSignupRequest `json:"request"`
28
28
Response CognitoEventUserPoolsPreSignupResponse `json:"response"`
29
29
}
30
30
31
- // CognitoEventUserPoolsPreAuthentication is sent by AWS Cognito User Pools when a user submits their information
31
+ // CognitoEventUserPoolsPreAuthentication is sent by Amazon Cognito User Pools when a user submits their information
32
32
// to be authenticated, allowing you to perform custom validations to accept or deny the sign in request.
33
33
type CognitoEventUserPoolsPreAuthentication struct {
34
34
CognitoEventUserPoolsHeader
35
35
Request CognitoEventUserPoolsPreAuthenticationRequest `json:"request"`
36
36
Response CognitoEventUserPoolsPreAuthenticationResponse `json:"response"`
37
37
}
38
38
39
- // CognitoEventUserPoolsPostConfirmation is sent by AWS Cognito User Pools after a user is confirmed,
39
+ // CognitoEventUserPoolsPostConfirmation is sent by Amazon Cognito User Pools after a user is confirmed,
40
40
// allowing the Lambda to send custom messages or add custom logic.
41
41
type CognitoEventUserPoolsPostConfirmation struct {
42
42
CognitoEventUserPoolsHeader
43
43
Request CognitoEventUserPoolsPostConfirmationRequest `json:"request"`
44
44
Response CognitoEventUserPoolsPostConfirmationResponse `json:"response"`
45
45
}
46
46
47
- // CognitoEventUserPoolsPreTokenGen is sent by AWS Cognito User Pools when a user attempts to retrieve
47
+ // CognitoEventUserPoolsPreTokenGen is sent by Amazon Cognito User Pools when a user attempts to retrieve
48
48
// credentials, allowing a Lambda to perform insert, suppress or override claims
49
49
type CognitoEventUserPoolsPreTokenGen struct {
50
50
CognitoEventUserPoolsHeader
51
51
Request CognitoEventUserPoolsPreTokenGenRequest `json:"request"`
52
52
Response CognitoEventUserPoolsPreTokenGenResponse `json:"response"`
53
53
}
54
54
55
- // CognitoEventUserPoolsPostAuthentication is sent by AWS Cognito User Pools after a user is authenticated,
55
+ // CognitoEventUserPoolsPreTokenGenV2 is sent by Amazon Cognito User Pools when a user attempts to retrieve
56
+ // credentials, allowing a Lambda to perform insert, suppress or override claims and scopes
57
+ type CognitoEventUserPoolsPreTokenGenV2 struct {
58
+ CognitoEventUserPoolsHeader
59
+ Request CognitoEventUserPoolsPreTokenGenV2Request `json:"request"`
60
+ Response CognitoEventUserPoolsPreTokenGenV2Response `json:"response"`
61
+ }
62
+
63
+ // CognitoEventUserPoolsPostAuthentication is sent by Amazon Cognito User Pools after a user is authenticated,
56
64
// allowing the Lambda to add custom logic.
57
65
type CognitoEventUserPoolsPostAuthentication struct {
58
66
CognitoEventUserPoolsHeader
59
67
Request CognitoEventUserPoolsPostAuthenticationRequest `json:"request"`
60
68
Response CognitoEventUserPoolsPostAuthenticationResponse `json:"response"`
61
69
}
62
70
63
- // CognitoEventUserPoolsMigrateUser is sent by AWS Cognito User Pools when a user does not exist in the
71
+ // CognitoEventUserPoolsMigrateUser is sent by Amazon Cognito User Pools when a user does not exist in the
64
72
// user pool at the time of sign-in with a password, or in the forgot-password flow.
65
73
type CognitoEventUserPoolsMigrateUser struct {
66
74
CognitoEventUserPoolsHeader
@@ -74,7 +82,7 @@ type CognitoEventUserPoolsCallerContext struct {
74
82
ClientID string `json:"clientId"`
75
83
}
76
84
77
- // CognitoEventUserPoolsHeader contains common data from events sent by AWS Cognito User Pools
85
+ // CognitoEventUserPoolsHeader contains common data from events sent by Amazon Cognito User Pools
78
86
type CognitoEventUserPoolsHeader struct {
79
87
Version string `json:"version"`
80
88
TriggerSource string `json:"triggerSource"`
@@ -125,11 +133,24 @@ type CognitoEventUserPoolsPreTokenGenRequest struct {
125
133
ClientMetadata map [string ]string `json:"clientMetadata"`
126
134
}
127
135
128
- // CognitoEventUserPoolsPreTokenGenResponse containst the response portion of a PreTokenGen event
136
+ // CognitoEventUserPoolsPreTokenGenV2Request contains request portion of V2 PreTokenGen event
137
+ type CognitoEventUserPoolsPreTokenGenV2Request struct {
138
+ UserAttributes map [string ]string `json:"userAttributes"`
139
+ GroupConfiguration GroupConfiguration `json:"groupConfiguration"`
140
+ ClientMetadata map [string ]string `json:"clientMetadata,omitempty"`
141
+ Scopes []string `json:"scopes"`
142
+ }
143
+
144
+ // CognitoEventUserPoolsPreTokenGenResponse contains the response portion of a PreTokenGen event
129
145
type CognitoEventUserPoolsPreTokenGenResponse struct {
130
146
ClaimsOverrideDetails ClaimsOverrideDetails `json:"claimsOverrideDetails"`
131
147
}
132
148
149
+ // CognitoEventUserPoolsPreTokenGenV2Response contains the response portion of a V2 PreTokenGen event
150
+ type CognitoEventUserPoolsPreTokenGenV2Response struct {
151
+ ClaimsAndScopeOverrideDetails ClaimsAndScopeOverrideDetails `json:"claimsAndScopeOverrideDetails"`
152
+ }
153
+
133
154
// CognitoEventUserPoolsPostAuthenticationRequest contains the request portion of a PostAuthentication event
134
155
type CognitoEventUserPoolsPostAuthenticationRequest struct {
135
156
NewDeviceUsed bool `json:"newDeviceUsed"`
@@ -157,14 +178,35 @@ type CognitoEventUserPoolsMigrateUserResponse struct {
157
178
ForceAliasCreation bool `json:"forceAliasCreation"`
158
179
}
159
180
181
+ // ClaimsAndScopeOverrideDetails allows lambda to add, suppress or override V2 claims and scopes in the token
182
+ type ClaimsAndScopeOverrideDetails struct {
183
+ IDTokenGeneration IDTokenGeneration `json:"idTokenGeneration"`
184
+ AccessTokenGeneration AccessTokenGeneration `json:"accessTokenGeneration"`
185
+ GroupOverrideDetails GroupConfiguration `json:"groupOverrideDetails"`
186
+ }
187
+
188
+ // IDTokenGeneration allows lambda to modify the ID token
189
+ type IDTokenGeneration struct {
190
+ ClaimsToAddOrOverride map [string ]string `json:"claimsToAddOrOverride"`
191
+ ClaimsToSuppress []string `json:"claimsToSuppress"`
192
+ }
193
+
194
+ // AccessTokenGeneration allows lambda to modify the access token
195
+ type AccessTokenGeneration struct {
196
+ ClaimsToAddOrOverride map [string ]string `json:"claimsToAddOrOverride"`
197
+ ClaimsToSuppress []string `json:"claimsToSuppress"`
198
+ ScopesToAdd []string `json:"scopesToAdd"`
199
+ ScopesToSuppress []string `json:"scopesToSuppress"`
200
+ }
201
+
160
202
// ClaimsOverrideDetails allows lambda to add, suppress or override claims in the token
161
203
type ClaimsOverrideDetails struct {
162
204
GroupOverrideDetails GroupConfiguration `json:"groupOverrideDetails"`
163
205
ClaimsToAddOrOverride map [string ]string `json:"claimsToAddOrOverride"`
164
206
ClaimsToSuppress []string `json:"claimsToSuppress"`
165
207
}
166
208
167
- // GroupConfiguration allows lambda to override groups, roles and set a perferred role
209
+ // GroupConfiguration allows lambda to override groups, roles and set a preferred role
168
210
type GroupConfiguration struct {
169
211
GroupsToOverride []string `json:"groupsToOverride"`
170
212
IAMRolesToOverride []string `json:"iamRolesToOverride"`
@@ -194,7 +236,7 @@ type CognitoEventUserPoolsDefineAuthChallengeResponse struct {
194
236
FailAuthentication bool `json:"failAuthentication"`
195
237
}
196
238
197
- // CognitoEventUserPoolsDefineAuthChallenge sent by AWS Cognito User Pools to initiate custom authentication flow
239
+ // CognitoEventUserPoolsDefineAuthChallenge sent by Amazon Cognito User Pools to initiate custom authentication flow
198
240
type CognitoEventUserPoolsDefineAuthChallenge struct {
199
241
CognitoEventUserPoolsHeader
200
242
Request CognitoEventUserPoolsDefineAuthChallengeRequest `json:"request"`
@@ -216,7 +258,7 @@ type CognitoEventUserPoolsCreateAuthChallengeResponse struct {
216
258
ChallengeMetadata string `json:"challengeMetadata"`
217
259
}
218
260
219
- // CognitoEventUserPoolsCreateAuthChallenge sent by AWS Cognito User Pools to create a challenge to present to the user
261
+ // CognitoEventUserPoolsCreateAuthChallenge sent by Amazon Cognito User Pools to create a challenge to present to the user
220
262
type CognitoEventUserPoolsCreateAuthChallenge struct {
221
263
CognitoEventUserPoolsHeader
222
264
Request CognitoEventUserPoolsCreateAuthChallengeRequest `json:"request"`
@@ -236,15 +278,15 @@ type CognitoEventUserPoolsVerifyAuthChallengeResponse struct {
236
278
AnswerCorrect bool `json:"answerCorrect"`
237
279
}
238
280
239
- // CognitoEventUserPoolsVerifyAuthChallenge sent by AWS Cognito User Pools to verify if the response from the end user
281
+ // CognitoEventUserPoolsVerifyAuthChallenge sent by Amazon Cognito User Pools to verify if the response from the end user
240
282
// for a custom Auth Challenge is valid or not
241
283
type CognitoEventUserPoolsVerifyAuthChallenge struct {
242
284
CognitoEventUserPoolsHeader
243
285
Request CognitoEventUserPoolsVerifyAuthChallengeRequest `json:"request"`
244
286
Response CognitoEventUserPoolsVerifyAuthChallengeResponse `json:"response"`
245
287
}
246
288
247
- // CognitoEventUserPoolsCustomMessage is sent by AWS Cognito User Pools before a verification or MFA message is sent,
289
+ // CognitoEventUserPoolsCustomMessage is sent by Amazon Cognito User Pools before a verification or MFA message is sent,
248
290
// allowing a user to customize the message dynamically.
249
291
type CognitoEventUserPoolsCustomMessage struct {
250
292
CognitoEventUserPoolsHeader
0 commit comments