Last active
April 5, 2018 23:50
-
-
Save tmaiaroto/f8db6a5ea2c6771c51c01c309ae89432 to your computer and use it in GitHub Desktop.
Cognito Lambda Trigger Types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-lambda-trigger-syntax-shared.html | |
// CognitoTriggerCallerContext contains information about the caller (should be the same for all triggers) | |
type CognitoTriggerCallerContext struct { | |
AWSSDKVersion string `json:"awsSdkVersion"` | |
ClientID string `json:"clientId"` | |
} | |
// CognitoTriggerCommon contains common data from events sent by AWS Cognito (should be the same for all triggers) | |
type CognitoTriggerCommon struct { | |
Version string `json:"version"` | |
TriggerSource string `json:"triggerSource"` | |
Region string `json:"region"` | |
UserPoolID string `json:"userPoolId"` | |
CallerContext CognitoTriggerCallerContext `json:"callerContext"` | |
UserName string `json:"userName"` | |
} | |
// CognitoTriggerPreSignup is invoked when a user submits their information to sign up, allowing you to perform | |
// custom validation to accept or deny the sign up request. | |
// triggerSource: PreSignUp_AdminCreateUser, PreSignUp_SignUp | |
type CognitoTriggerPreSignup struct { | |
CognitoTriggerCommon | |
Request struct { | |
UserAttributes map[string]interface{} `json:"userAttributes"` | |
ValidationData map[string]interface{} `json:"validationData"` | |
} `json:"request"` | |
Response struct { | |
AutoConfirmUser bool `json:"autoConfirmUser"` | |
AutoVerifyEmail bool `json:"autoVerifyEmail"` | |
AutoVerifyPhone bool `json:"autoVerifyPhone"` | |
} `json:"response"` | |
} | |
// CognitoTriggerPostConfirmation is invoked after a user is confirmed, allowing you to send custom messages | |
// or to add custom logic, for example for analytics. | |
// triggerSource: PostConfirmation_ConfirmSignUp, PostConfirmation_ConfirmForgotPassword | |
type CognitoTriggerPostConfirmation struct { | |
CognitoTriggerCommon | |
Request struct { | |
UserAttributes map[string]interface{} `json:"userAttributes"` | |
} `json:"request"` | |
Response map[string]interface{} `json:"response"` | |
} | |
// CognitoTriggerCustomMessage is invoked before a verification or MFA message is sent, allowing you to | |
// customize the message dynamically. Note that static custom messages can be edited on the Verifications panel. | |
// triggerSource: CustomMessage_ResendCode | |
type CognitoTriggerCustomMessage struct { | |
CognitoTriggerCommon | |
Request struct { | |
UserAttributes map[string]interface{} `json:"userAttributes"` | |
CodeParameter string `json:"codeParameter"` | |
UsernameParameter string `json:"usernameParameter"` | |
} `json:"request"` | |
Response struct { | |
SMSMessage string `json:"smsMessage"` | |
EmailMessage string `json:"emailMessage"` | |
EmailSubject string `json:"emailSubject"` | |
} `json:"response"` | |
} | |
// CognitoTriggerPostAuthentication is invoked after a user is authenticated, allowing you to add custom logic, | |
// for example for analytics. | |
// triggerSource: PostAuthentication_Authentication | |
type CognitoTriggerPostAuthentication struct { | |
CognitoTriggerCommon | |
Request struct { | |
UserAttributes map[string]interface{} `json:"userAttributes"` | |
NewDeviceUsed bool `json:"newDeviceUsed"` | |
} `json:"request"` | |
Response map[string]interface{} `json:"response"` | |
} | |
// CognitoTriggerPreAuthentication is invoked when a user submits their information to be authenticated, allowing | |
// you to perform custom validations to accept or deny the sign in request. | |
// triggerSource: PreAuthentication_Authentication | |
type CognitoTriggerPreAuthentication struct { | |
CognitoTriggerCommon | |
Request struct { | |
UserAttributes map[string]interface{} `json:"userAttributes"` | |
ValidationData map[string]interface{} `json:"validationData"` | |
} `json:"request"` | |
Response map[string]interface{} `json:"response"` | |
} | |
// CognitoTriggerTokenGeneration is invoked before the token generation, allowing you to customize the claims | |
// in the identity token. | |
// triggerSource: TokenGeneration_HostedAuth | |
type CognitoTriggerTokenGeneration struct { | |
CognitoTriggerCommon | |
Request struct { | |
UserAttributes map[string]interface{} `json:"userAttributes"` | |
GroupConfiguration map[string]interface{} `json:"groupConfiguration"` | |
} `json:"request"` | |
Response map[string]interface{} `json:"response"` // default is map[claimsOverrideDetails: <nil>] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist may fall out of date, https://github.com/tmaiaroto/aegis/blob/master/framework/cognito_trigger_types.go will be a better source for updates though it will include other things you likely won't care about too.