简体   繁体   English

AWS API Gateway - 一切都“需要 API 密钥”

[英]AWS API Gateway - "Require API key" on everything

Currently, this is how I am securing API gateway endpoints.目前,这就是我保护 API 网关端点的方式。

I set an API key and a usage plan and then for each endpoint:我设置了一个 API 密钥和一个使用计划,然后为每个端点设置:

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

I would like to secure everything in the API this way.我想以这种方式保护 API 中的所有内容。 Is there a more convenient way to do it?有没有更方便的方法呢? Everything means all endpoints and all methods.一切意味着所有端点和所有方法。

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

In this answer https://stackoverflow.com/a/70296022/2692914 I've put a script for the part that enables the API key for all methods of certain API.在这个答案https://stackoverflow.com/a/70296022/2692914 中,我已经为该部分放置了一个脚本,该脚本为某些 API 的所有方法启用 API 密钥。

Also, you can find the script to enable the API key for all methods of an API Gateway API on this gist .此外,您可以在此 gist 上找到为 API Gateway API 的所有方法启用 API 密钥脚本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM