Files
floci/src/test/java
seniorescobar 9705b2584d fix(cognito): forward SignUp ValidationData and ClientMetadata to the pre-signup trigger (#5825)
* fix(cognito): forward SignUp ValidationData and ClientMetadata to the pre-signup trigger

Real Amazon Cognito delivers the SignUp request's ValidationData and
ClientMetadata to the pre-signup Lambda trigger as request.validationData
and request.clientMetadata (see the pre sign-up trigger docs). The SignUp
path parsed only UserAttributes and called signUp without them, so
firePreSignUp always received empty maps — unlike AdminCreateUser, which
already parses and forwards both fields. The auto-confirm PostConfirmation
firing dropped ClientMetadata the same way.

Parse both fields in handleSignUp and thread them through signUp →
signUpWithReservedUsername → firePreSignUp, mirroring the AdminCreateUser
plumbing, pass ClientMetadata on to PostConfirmation when PreSignUp
auto-confirms, and cover both with JSON-handler-level regression tests.
Adapted to #5783's signup restructure (callers of signUp in its new tests
pass explicit empty maps).

* refactor(cognito): extract name/value pair parsing helper

The Name/Value forEach loop was copied six times across AdminCreateUser,
AdminUpdateUserAttributes, SignUp and UpdateUserAttributes. One
readNameValuePairs helper next to readStringList now serves all six.

* fix(cognito): forward ClientMetadata to CustomMessage trigger sources

fireCustomMessage hardcoded an empty clientMetadata map. It now takes the
calling action's metadata so SignUp can pass the request's ClientMetadata
to CustomMessage_SignUp, as the developer guide lists for that source.
The other sources keep an empty map: ResendConfirmationCode and
ForgotPassword do not accept ClientMetadata at all yet, and the guide
excludes InitiateAuth-family metadata from custom message requests, so
the MFA and OTP CustomMessage_Authentication paths deliberately pass
none. Regression test asserts CustomMessage_SignUp receives the signup
metadata.
2026-10-17 09:27:45 -04:00
..