aws-cognito: identity provider attribute mapping mishandles custom attributes #26820
Labels
@aws-cdk/aws-cognito
Related to Amazon Cognito
bug
This issue is a bug.
documentation
This is a problem with documentation.
effort/small
Small work item – less than a day of effort
p3
Describe the bug
I have added a custom attribute to my Cognito user pool and I wanted for an identity provider to map a claim to this custom attribute.
Following the documentation at https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.AttributeMapping.html I defined the mapping like this
And then pass that to the
UserPoolIdentityProviderOidcProps
'sattributeMapping
property.However, this generates the wrong CloudFormation template, as the custom attribute is not prefixed with
custom:
. Although it deploys, when editing the mapping from the console, the mapping is not recognized, but if modified manually the console adds thecustom:
prefix.The generated template looks like this
When it should look like
Expected Behavior
The generated template should looks like this
Current Behavior
The generated template should looks like this
Reproduction Steps
Possible Solution
A workaround is to define the mapping as follows
I think the problem is in https://github.com/aws/aws-cdk/blame/00a7f033f6ad19160a7350784243ecf9c71c388b/packages/aws-cdk-lib/aws-cognito/lib/user-pool-idps/private/user-pool-idp-base.ts#L33C11-L33C11
Instead of
The code should probably read
Additional Information/Context
No response
CDK CLI Version
2.92.0
Framework Version
2.92.0
Node.js Version
v16.18.1
OS
Linux
Language
Typescript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: