Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clientMetadata to triggers that support it #256

Merged
merged 2 commits into from
Jan 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion events/cognito.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ type CognitoEventUserPoolsHeader struct {
type CognitoEventUserPoolsPreSignupRequest struct {
UserAttributes map[string]string `json:"userAttributes"`
ValidationData map[string]string `json:"validationData"`
ClientMetadata map[string]string `json:"clientMetadata"`
}

// CognitoEventUserPoolsPreSignupResponse contains the response portion of a PreSignup event
Expand All @@ -110,6 +111,7 @@ type CognitoEventUserPoolsPreAuthenticationResponse struct {
// CognitoEventUserPoolsPostConfirmationRequest contains the request portion of a PostConfirmation event
type CognitoEventUserPoolsPostConfirmationRequest struct {
UserAttributes map[string]string `json:"userAttributes"`
ClientMetadata map[string]string `json:"clientMetadata"`
}

// CognitoEventUserPoolsPostConfirmationResponse contains the response portion of a PostConfirmation event
Expand All @@ -120,6 +122,7 @@ type CognitoEventUserPoolsPostConfirmationResponse struct {
type CognitoEventUserPoolsPreTokenGenRequest struct {
UserAttributes map[string]string `json:"userAttributes"`
GroupConfiguration GroupConfiguration `json:"groupConfiguration"`
ClientMetadata map[string]string `json:"clientMetadata"`
}

// CognitoEventUserPoolsPreTokenGenResponse containst the response portion of a PreTokenGen event
Expand All @@ -131,6 +134,7 @@ type CognitoEventUserPoolsPreTokenGenResponse struct {
type CognitoEventUserPoolsPostAuthenticationRequest struct {
NewDeviceUsed bool `json:"newDeviceUsed"`
UserAttributes map[string]string `json:"userAttributes"`
ClientMetadata map[string]string `json:"clientMetadata"`
}

// CognitoEventUserPoolsPostAuthenticationResponse contains the response portion of a PostAuthentication event
Expand All @@ -139,7 +143,8 @@ type CognitoEventUserPoolsPostAuthenticationResponse struct {

// CognitoEventUserPoolsMigrateUserRequest contains the request portion of a MigrateUser event
type CognitoEventUserPoolsMigrateUserRequest struct {
Password string `json:"password"`
Password string `json:"password"`
ClientMetadata map[string]string `json:"clientMetadata"`
}

// CognitoEventUserPoolsMigrateUserResponse contains the response portion of a MigrateUser event
Expand Down Expand Up @@ -177,6 +182,7 @@ type CognitoEventUserPoolsChallengeResult struct {
type CognitoEventUserPoolsDefineAuthChallengeRequest struct {
UserAttributes map[string]string `json:"userAttributes"`
Session []*CognitoEventUserPoolsChallengeResult `json:"session"`
ClientMetadata map[string]string `json:"clientMetadata"`
}

// CognitoEventUserPoolsDefineAuthChallengeResponse defines auth challenge response parameters
Expand All @@ -198,6 +204,7 @@ type CognitoEventUserPoolsCreateAuthChallengeRequest struct {
UserAttributes map[string]string `json:"userAttributes"`
ChallengeName string `json:"challengeName"`
Session []*CognitoEventUserPoolsChallengeResult `json:"session"`
ClientMetadata map[string]string `json:"clientMetadata"`
}

// CognitoEventUserPoolsCreateAuthChallengeResponse defines create auth challenge response rarameters
Expand All @@ -219,6 +226,7 @@ type CognitoEventUserPoolsVerifyAuthChallengeRequest struct {
UserAttributes map[string]string `json:"userAttributes"`
PrivateChallengeParameters map[string]string `json:"privateChallengeParameters"`
ChallengeAnswer interface{} `json:"challengeAnswer"`
ClientMetadata map[string]string `json:"clientMetadata"`
}

// CognitoEventUserPoolsVerifyAuthChallengeResponse defines verify auth challenge response parameters
Expand Down Expand Up @@ -247,6 +255,7 @@ type CognitoEventUserPoolsCustomMessageRequest struct {
UserAttributes map[string]interface{} `json:"userAttributes"`
CodeParameter string `json:"codeParameter"`
UsernameParameter string `json:"usernameParameter"`
ClientMetadata map[string]string `json:"clientMetadata"`
}

// CognitoEventUserPoolsCustomMessageResponse contains the response portion of a CustomMessage event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
"challengeResult": true,
"challengeMetadata": "metadata"
}
]
],
"clientMetadata": {
"exampleMetadataKey": "example metadata value"
}
},
"response": {
"publicChallengeParameters": {
Expand Down
5 changes: 4 additions & 1 deletion events/testdata/cognito-event-userpools-custommessage.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"email_verified": false
},
"codeParameter": "####",
"usernameParameter": "{username}"
"usernameParameter": "{username}",
"clientMetadata": {
"exampleMetadataKey": "example metadata value"
}
},
"response": {
"smsMessage": "<custom message to be sent in the message with code parameter>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
"challengeResult": true,
"challengeMetadata": "metadata"
}
]
],
"clientMetadata": {
"exampleMetadataKey": "example metadata value"
}
},
"response": {
"challengeName": "challengeName",
Expand Down
5 changes: 4 additions & 1 deletion events/testdata/cognito-event-userpools-migrateuser.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
"clientId": "<apps client id>"
},
"request": {
"password": "<password>"
"password": "<password>",
"clientMetadata": {
"exampleMetadataKey": "example metadata value"
}
},
"response": {
"userAttributes": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"userAttributes" : {
"email": "<email>",
"phone_number": "<phone_number>"
},
"clientMetadata": {
"exampleMetadataKey": "example metadata value"
}
},
"response": {}
Expand Down
3 changes: 3 additions & 0 deletions events/testdata/cognito-event-userpools-postconfirmation.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"userAttributes" : {
"email": "<email>",
"phone_number": "<phone_number>"
},
"clientMetadata": {
"exampleMetadataKey": "example metadata value"
}
},
"response": {}
Expand Down
5 changes: 4 additions & 1 deletion events/testdata/cognito-event-userpools-presignup.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
"validationData": {
"k1": "v1",
"k2": "v2"
}
},
"clientMetadata": {
"exampleMetadataKey": "example metadata value"
}
},
"response": {
"autoConfirmUser": false,
Expand Down
3 changes: 3 additions & 0 deletions events/testdata/cognito-event-userpools-pretokengen.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"groupsToOverride": ["group-A", "group-B", "group-C"],
"iamRolesToOverride": ["arn:aws:iam::XXXXXXXXXXXX:role/sns_callerA", "arn:aws:iam::XXXXXXXXX:role/sns_callerB", "arn:aws:iam::XXXXXXXXXX:role/sns_callerC"],
"preferredRole": "arn:aws:iam::XXXXXXXXXXX:role/sns_caller"
},
"clientMetadata": {
"exampleMetadataKey": "example metadata value"
}
},
"response": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
"privateChallengeParameters": {
"secret": "11122233"
},
"challengeAnswer": "123xxxx"
"challengeAnswer": "123xxxx",
"clientMetadata": {
"exampleMetadataKey": "example metadata value"
}
},
"response": {
"answerCorrect": true
Expand Down