@@ -54,12 +54,23 @@ type CognitoEventUserPoolsPreTokenGen struct {
54
54
55
55
// CognitoEventUserPoolsPreTokenGenV2 is sent by Amazon Cognito User Pools when a user attempts to retrieve
56
56
// credentials, allowing a Lambda to perform insert, suppress or override claims and scopes
57
+ //
58
+ // Deprecated: Use CognitoEventUserPoolsPreTokenGenV2_0 instead.
59
+ // This struct incorrectly restricts the ClaimsToAddOrOverride values as strings, but Cogntio supports any type.
57
60
type CognitoEventUserPoolsPreTokenGenV2 struct {
58
61
CognitoEventUserPoolsHeader
59
62
Request CognitoEventUserPoolsPreTokenGenV2Request `json:"request"`
60
63
Response CognitoEventUserPoolsPreTokenGenV2Response `json:"response"`
61
64
}
62
65
66
+ // CognitoEventUserPoolsPreTokenGenV2_0 is sent by Amazon Cognito User Pools when a user attempts to retrieve
67
+ // credentials, allowing a Lambda to perform insert, suppress or override claims and scopes
68
+ type CognitoEventUserPoolsPreTokenGenV2_0 struct {
69
+ CognitoEventUserPoolsHeader
70
+ Request CognitoEventUserPoolsPreTokenGenRequestV2_0 `json:"request"`
71
+ Response CognitoEventUserPoolsPreTokenGenResponseV2_0 `json:"response"`
72
+ }
73
+
63
74
// CognitoEventUserPoolsPostAuthentication is sent by Amazon Cognito User Pools after a user is authenticated,
64
75
// allowing the Lambda to add custom logic.
65
76
type CognitoEventUserPoolsPostAuthentication struct {
@@ -134,23 +145,40 @@ type CognitoEventUserPoolsPreTokenGenRequest struct {
134
145
}
135
146
136
147
// CognitoEventUserPoolsPreTokenGenV2Request contains request portion of V2 PreTokenGen event
148
+ //
149
+ // Deprecated: Use CognitoEventUserPoolsPreTokenGenRequestV2_0 instead
137
150
type CognitoEventUserPoolsPreTokenGenV2Request struct {
138
151
UserAttributes map [string ]string `json:"userAttributes"`
139
152
GroupConfiguration GroupConfiguration `json:"groupConfiguration"`
140
153
ClientMetadata map [string ]string `json:"clientMetadata,omitempty"`
141
154
Scopes []string `json:"scopes"`
142
155
}
143
156
157
+ // CognitoEventUserPoolsPreTokenGenRequestV2_0 contains request portion of V2 PreTokenGen event
158
+ type CognitoEventUserPoolsPreTokenGenRequestV2_0 struct {
159
+ UserAttributes map [string ]string `json:"userAttributes"`
160
+ GroupConfiguration GroupConfigurationV2_0 `json:"groupConfiguration"`
161
+ ClientMetadata map [string ]string `json:"clientMetadata,omitempty"`
162
+ Scopes []string `json:"scopes"`
163
+ }
164
+
144
165
// CognitoEventUserPoolsPreTokenGenResponse contains the response portion of a PreTokenGen event
145
166
type CognitoEventUserPoolsPreTokenGenResponse struct {
146
167
ClaimsOverrideDetails ClaimsOverrideDetails `json:"claimsOverrideDetails"`
147
168
}
148
169
149
170
// CognitoEventUserPoolsPreTokenGenV2Response contains the response portion of a V2 PreTokenGen event
171
+ //
172
+ // Deprecated: Use CognitoEventUserPoolsPreTokenGenResponseV2_0 instead
150
173
type CognitoEventUserPoolsPreTokenGenV2Response struct {
151
174
ClaimsAndScopeOverrideDetails ClaimsAndScopeOverrideDetails `json:"claimsAndScopeOverrideDetails"`
152
175
}
153
176
177
+ // CognitoEventUserPoolsPreTokenGenResponseV2_0 contains the response portion of a V2 PreTokenGen event
178
+ type CognitoEventUserPoolsPreTokenGenResponseV2_0 struct {
179
+ ClaimsAndScopeOverrideDetails ClaimsAndScopeOverrideDetailsV2_0 `json:"claimsAndScopeOverrideDetails"`
180
+ }
181
+
154
182
// CognitoEventUserPoolsPostAuthenticationRequest contains the request portion of a PostAuthentication event
155
183
type CognitoEventUserPoolsPostAuthenticationRequest struct {
156
184
NewDeviceUsed bool `json:"newDeviceUsed"`
@@ -179,26 +207,51 @@ type CognitoEventUserPoolsMigrateUserResponse struct {
179
207
}
180
208
181
209
// ClaimsAndScopeOverrideDetails allows lambda to add, suppress or override V2 claims and scopes in the token
210
+ //
211
+ // Deprecated: Use ClaimsAndScopeOverrideDetailsV2_0 instead
182
212
type ClaimsAndScopeOverrideDetails struct {
183
213
IDTokenGeneration IDTokenGeneration `json:"idTokenGeneration"`
184
214
AccessTokenGeneration AccessTokenGeneration `json:"accessTokenGeneration"`
185
215
GroupOverrideDetails GroupConfiguration `json:"groupOverrideDetails"`
186
216
}
187
217
218
+ // ClaimsAndScopeOverrideDetailsV2 allows lambda to add, suppress or override V2 claims and scopes in the token
219
+ type ClaimsAndScopeOverrideDetailsV2_0 struct {
220
+ IDTokenGeneration IDTokenGenerationV2_0 `json:"idTokenGeneration"`
221
+ AccessTokenGeneration AccessTokenGenerationV2_0 `json:"accessTokenGeneration"`
222
+ GroupOverrideDetails GroupConfigurationV2_0 `json:"groupOverrideDetails"`
223
+ }
224
+
188
225
// IDTokenGeneration allows lambda to modify the ID token
189
226
type IDTokenGeneration struct {
190
227
ClaimsToAddOrOverride map [string ]string `json:"claimsToAddOrOverride"`
191
228
ClaimsToSuppress []string `json:"claimsToSuppress"`
192
229
}
193
230
231
+ // IDTokenGenerationV2_0 allows lambda to modify the ID token
232
+ type IDTokenGenerationV2_0 struct {
233
+ ClaimsToAddOrOverride map [string ]interface {} `json:"claimsToAddOrOverride"`
234
+ ClaimsToSuppress []string `json:"claimsToSuppress"`
235
+ }
236
+
194
237
// AccessTokenGeneration allows lambda to modify the access token
238
+ //
239
+ // Deprecated: Use AccessTokenGenerationV2_0 instead
195
240
type AccessTokenGeneration struct {
196
241
ClaimsToAddOrOverride map [string ]string `json:"claimsToAddOrOverride"`
197
242
ClaimsToSuppress []string `json:"claimsToSuppress"`
198
243
ScopesToAdd []string `json:"scopesToAdd"`
199
244
ScopesToSuppress []string `json:"scopesToSuppress"`
200
245
}
201
246
247
+ // AccessTokenGenerationV2_0 allows lambda to modify the access token
248
+ type AccessTokenGenerationV2_0 struct {
249
+ ClaimsToAddOrOverride map [string ]interface {} `json:"claimsToAddOrOverride"`
250
+ ClaimsToSuppress []string `json:"claimsToSuppress"`
251
+ ScopesToAdd []string `json:"scopesToAdd"`
252
+ ScopesToSuppress []string `json:"scopesToSuppress"`
253
+ }
254
+
202
255
// ClaimsOverrideDetails allows lambda to add, suppress or override claims in the token
203
256
type ClaimsOverrideDetails struct {
204
257
GroupOverrideDetails GroupConfiguration `json:"groupOverrideDetails"`
@@ -213,6 +266,13 @@ type GroupConfiguration struct {
213
266
PreferredRole * string `json:"preferredRole"`
214
267
}
215
268
269
+ // GroupConfigurationV2_0 allows lambda to override groups, roles and set a preferred role
270
+ type GroupConfigurationV2_0 struct {
271
+ GroupsToOverride []string `json:"groupsToOverride"`
272
+ IAMRolesToOverride []string `json:"iamRolesToOverride"`
273
+ PreferredRole * string `json:"preferredRole"`
274
+ }
275
+
216
276
// CognitoEventUserPoolsChallengeResult represents a challenge that is presented to the user in the authentication
217
277
// process that is underway, along with the corresponding result.
218
278
type CognitoEventUserPoolsChallengeResult struct {
0 commit comments