【发布时间】:2020-06-21 16:31:03
【问题描述】:
我正在使用无服务器框架来处理我的 CloudFormation 内容。我正在构建一个用户池,其中包含具有自己角色的组。我想构建我的身份池,以便将 Authenticated role selection 的 Cognito 提供程序设置设置为 Choose role from token,其中 Role resolultion 为 DENY。
这是我的相关 CloudFormation - 忽略 ${self:custom....} 的东西:
IdentityPool:
Type: AWS::Cognito::IdentityPool
Properties:
IdentityPoolName: ${self:custom.identityPoolName}
AllowUnauthenticatedIdentities: false
CognitoIdentityProviders:
- ClientId:
Ref: UserPoolClient
ProviderName:
Fn::GetAtt: ["UserPool", "ProviderName"]
IdentityPoolRoleAttachment:
Type: AWS::Cognito::IdentityPoolRoleAttachment
Properties:
IdentityPoolId:
Ref: IdentityPool
RoleMappings:
CognitoProvider:
IdentityProvider:
Fn::Join:
- ""
- - "cognito-idp."
- Ref: AWS::Region
- ".amazonaws.com/"
- Ref: UserPool
- ":"
- Ref: UserPoolClient
Type: Token
AmbiguousRoleResolution: Deny
这不起作用,因为IdentityPoolRoleAttachment 需要Roles 部分。但我不想将经过身份验证和未经身份验证的角色与身份池一起使用。我希望 Identity Pool Cognito 提供者只检查传入的令牌。
这是我得到的错误:
ServerlessError: An error occurred: IdentityPoolRoleAttachment - 1 validation error detected: Value null at 'roles' failed to satisfy constraint: Member must not be null (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: ValidationException; Request ID: 80026230-eaa9-4045-86d8-6fe4c07cce9d).
我该怎么做?我是否需要创建一个空角色并将其分配给IdentityPoolRoleAttachment?
我可以在控制台中没有身份池角色的情况下执行此操作。
【问题讨论】:
标签: amazon-web-services amazon-cloudformation amazon-cognito serverless-framework