Description
The following role mapping will fail:
const identityPool = new IdentityPool(this, "IdentityPool", {
roleMappings: [
{
providerUrl: IdentityPoolProviderUrl.custom(userPool.userPoolProviderUrl),
resolveAmbiguousRoles: false,
useToken: true
}
]
})
The reason it will fail is because the internal logic is to map the provided URL as the corresponding key value, which is performed here.
The same function is achieved in Cloudformation by specifying the key separately from the provider url. See notes specified under the IdentityProvider field description.
Use Case
Referencing user pool from the same stack.
Proposed Solution
Allow the ability to optionally specify static key when creating a role mapping.
Other information
Possible (untested) workaround is to create role attachment with Cfn resource and manually assign an arbitrary key.
const identityPool = new IdentityPool(this, "IdentityPool", {
allowUnauthenticatedIdentities: false
})
new CfnIdentityPoolRoleAttachment(this, "RoleAttachment2", {
identityPoolId: identityPool.identityPoolId,
roleMappings: {
cognito: { // 👈 manually specified key of "cognito"
type: "Token",
ambiguousRoleResolution: "Deny",
identityProvider: userPool.userPoolProviderUrl
}
}
}).node.addDependency(identityPool)
Acknowledge
Description
The following role mapping will fail:
The reason it will fail is because the internal logic is to map the provided URL as the corresponding key value, which is performed here.
The same function is achieved in Cloudformation by specifying the key separately from the provider url. See notes specified under the IdentityProvider field description.
Use Case
Referencing user pool from the same stack.
Proposed Solution
Allow the ability to optionally specify static key when creating a role mapping.
Other information
Possible (untested) workaround is to create role attachment with Cfn resource and manually assign an arbitrary key.
Acknowledge