【问题标题】:AWS API Gateway - "Require API key" on everythingAWS API Gateway - 一切都“需要 API 密钥”
【发布时间】:2021-12-10 04:14:26
【问题描述】:

目前,这就是我保护 API 网关端点的方式。

我设置了一个 API 密钥和一个使用计划,然后为每个端点设置:

"Endpoint > Method Request > API Key Required = true"

我想以这种方式保护 API 中的所有内容。 有没有更方便的方法呢? 一切都意味着所有端点和所有方法。

【问题讨论】:

    标签: amazon-web-services authentication aws-api-gateway


    【解决方案1】:

    根据 AWS 文档 here,API 密钥是按方法管理的,因此不能在资源或全局 API 级别应用。

    【讨论】:

      【解决方案2】:

      在这个答案https://stackoverflow.com/a/70296022/2692914 中,我为启用特定 API 的所有方法的 API 密钥的部分放置了一个脚本。

      另外,您可以找到script to enable the API key for all methods of an API Gateway API on this gist

      【讨论】:

        猜你喜欢
        • 2019-01-07
        • 2020-09-25
        • 2017-05-01
        • 2018-02-01
        • 1970-01-01
        • 1970-01-01
        • 2020-10-05
        • 1970-01-01
        • 2017-01-22
        相关资源
        最近更新 更多