CognitoAuthorizer - Amazon Serverless Application Model
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

CognitoAuthorizer

定义 Amazon Cognito 用户群体授权方。

有关更多信息以及示例,请参阅 控制 API Gateway API 访问权限

语法

要在您的 Amazon Serverless Application Model (Amazon SAM) 模板中声明此实体,请使用以下语法。

属性

AuthorizationScopes

此授权方的授权范围列表。

类型:列表

必需:否

Amazon CloudFormation 兼容性:此属性为 Amazon SAM 独有,没有 Amazon CloudFormation 等效属性。

Identity

此属性可用于在授权方传入请求中指定 IdentitySource

类型:CognitoAuthorizationIdentity

必需:否

Amazon CloudFormation 兼容性:此属性为 Amazon SAM 独有,没有 Amazon CloudFormation 等效属性。

UserPoolArn

可以引用用户群体/指定要向其添加此 cognito 授权方的用户群体 arn

类型:字符串

必需:是

Amazon CloudFormation 兼容性:此属性为 Amazon SAM 独有,没有 Amazon CloudFormation 等效属性。

示例

CognitoAuth

Cognito 身份验证示例

YAML

Auth: Authorizers: MyCognitoAuth: AuthorizationScopes: - scope1 - scope2 UserPoolArn: Fn::GetAtt: - MyCognitoUserPool - Arn Identity: Header: MyAuthorizationHeader ValidationExpression: myauthvalidationexpression