首页 > 解决方案 > 如何使用自定义映射 cloudform cognito 用户池身份验证提供程序

问题描述

我已经成功地 cloudformed 一个 cognito 身份池,但看不到如何将自定义映射添加到 cloudformation 中的“Cognito”“身份验证提供程序”。

在控制台上的 Cognito 身份验证提供程序内,有一个下拉列表,我必须手动选择“使用自定义映射”,然后我可以手动将映射添加到我的自定义用户属性。但是,我需要能够对此进行云化处理,并且正在努力为它找到正确的位置。

与此身份池一起使用的用户池将“SupportedIdentityProviders”设置为“COGNITO”

更新

我可以通过运行来获取身份提供者列表...

aws cognito-identity list-identities --max-results 2 --identity-pool-id xx-xxxx-x:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx

这让我回来了

{
    "IdentityPoolId": "xx-xxxx-x:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
    "Identities": [
        {
            "IdentityId": "yy-yyyy-y:yyyyyyyy-yyyy-yyyy-yyyyyyyyyy",
            "Logins": [
                "cognito-idp.eu-west-2.amazonaws.com/eu-west-2_tFT6FBwIO"
            ],
            "CreationDate": "2021-11-15T12:38:48.249000+00:00",
            "LastModifiedDate": "2021-11-15T12:38:48.263000+00:00"
        }
    ]
}

使用“登录”信息我现在可以运行...

aws cognito-identity get-principal-tag-attribute-map --identity-pool-id xx-xxxx-x:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx --identity-provider-name "cognito-idp.eu-west-2.amazonaws.com/eu-west-2_tFT6FBwIO"

返回

{
    "IdentityPoolId": "xx-xxxx-x:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
    "IdentityProviderName": "cognito-idp.eu-west-2.amazonaws.com/eu-west-2_tFT6FBwIO",
    "UseDefaults": false,
    "PrincipalTags": {
        "attr_x": "custom:attr_x",
        "attr_y": "custom:attr_y",
        "attr_z": "custom:attr_z"
    }
}

但是,我仍然不知道如何通过 cloudformation 设置此映射...

问候马克。

标签: amazon-cognitoaws-userpoolsaws-identitypools

解决方案


CloudFormation 尚不支持设置 PrincipalTag 属性映射,但根据 CloudFormation 路线图,很快就会支持。同时,您必须创建CloudFormation 自定义资源资源提供者来实现此目的。


推荐阅读