feat(cognito): honor a custom ClientSecret on CreateUserPoolClient
ZE
5d ago+179+179+012345678901234567890123456789-7-7-0123456789
Summary
Closes #2750.
CreateUserPoolClienttakes a caller-chosenClientSecretand makes it the app client's secret, soDescribeUserPoolClient, the/oauth2/tokenclient authentication andSECRET_HASHchecks all use it. WithoutClientSecretnothing changes.- The value is checked against
ClientSecretType(24-64 characters matching[\w+]+); a value outside it fails withInvalidParameterExceptionand the standard1 validation error detectedmessage, which leaves the value out because the member is@sensitive.ClientSecrettogether withGenerateSecret: truefails withInvalidParameterException, as the API reference says. - Docs: the app clients line of
docs/services/cognito.md.
Not changed here:
- CloudFormation:
AWS::Cognito::UserPoolClienthas noClientSecretproperty ("you can't specify a secret value"), so the provisioner stays as it is. - The secret-rotation operations (
AddUserPoolClientSecretand friends) keep their current behaviour; they are a separate feature. - No SDK helpers: this is a standard API field, not a
/_fakecloudendpoint.
Usage, together with the fixed ids from #2703:
aws cognito-idp create-user-pool --pool-name local --user-pool-tags _custom_id_=us-east-1_Local
aws cognito-idp create-user-pool-client --user-pool-id us-east-1_Local \
--client-name _custom_id_:localclient --client-secret local_dev_client_secret_0123456789
Test plan
- Unit (
fakecloud-cognito, 430 pass): the custom secret is returned and stored as the client's secret; too short, too long, outside the pattern and withGenerateSecret: trueare rejected withInvalidParameterExceptionwithout the value in the message; the 24 and 64 character bounds are accepted. - E2E
cognito_create_user_pool_client_with_custom_secret(aws-sdk-rust): create withclient_secret,DescribeUserPoolClientreturns it, aclient_credentialsgrant at/oauth2/tokenauthenticates with it, andGenerateSecret+ClientSecretand a short secret fail withInvalidParameterException. cognito,cognito_persistenceandcognito_authorizee2e pass; conformancerun --services cognito-idp4812/4812;cargo fmt --all --checkandcargo clippy -p fakecloud-cognito -p fakecloud-e2e --all-targets -- -D warningsclean.
Summary by cubic
Lets CreateUserPoolClient take a caller-chosen ClientSecret and make it the app client's secret, so DescribeUserPoolClient, /oauth2/token client authentication, and SECRET_HASH checks all use it. Without ClientSecret, nothing changes. Closes #2750.
- The value must be 24-64 characters matching
[\w+]+; anything else fails withInvalidParameterExceptionwithout echoing the value, since the member is sensitive. ClientSecrettogether withGenerateSecret: trueis rejected withInvalidParameterException, per the API reference.- CloudFormation and the secret-rotation operations are unchanged.