如何对 AWS API 网关的用户进行身份验证?
How to authenticate users for AWS API Gateway?
我正在使用 AWS API 网关和 AWS Lambda 创建一个无服务器的 REST API。当端点已创建并与相应的 Lambda 函数链接时,下一步是添加身份验证层以通过电子邮件和密码对用户进行身份验证。据我从文档中了解到,API 网关方法可以支持 API 基于密钥的访问或基于 IAM 的访问。但我无法理解如何使用 API 密钥安全地实施身份验证。
我是否必须创建一个服务器来进行身份验证和管理用户?有什么方法可以成为一个完整的服务器端到端应用程序?任何指向正确方向的资源都将受到高度赞赏。我现在正在看this document
最近的公告是 API 网关自定义授权方:http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html
"you can control access to your APIs using bearer token authentication strategies, such as OAuth or SAML. To do so, you provide and configure a custom authorizer, a Lambda function you own, for API Gateway to use to authorize the client requests for the configured APIs"
另一个我认为是在自定义授权器发布之前编写的好资源:https://auth0.com/docs/integrations/aws-api-gateway/part-2
AWS API 网关也可以使用 API 密钥进行身份验证。
请按照以下步骤操作:-
- 在 API 网关的资源方法中设置 API 密钥。
- 创建使用计划并添加关联的 API 个阶段
- 创建 API 密钥并与使用计划相关联。
之后调用 API 网关时需要传递 API 密钥
作为页眉。
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(new MediaType[]{MediaType.APPLICATION_JSON}));
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("x-api-key", apiKey);
我正在使用 AWS API 网关和 AWS Lambda 创建一个无服务器的 REST API。当端点已创建并与相应的 Lambda 函数链接时,下一步是添加身份验证层以通过电子邮件和密码对用户进行身份验证。据我从文档中了解到,API 网关方法可以支持 API 基于密钥的访问或基于 IAM 的访问。但我无法理解如何使用 API 密钥安全地实施身份验证。
我是否必须创建一个服务器来进行身份验证和管理用户?有什么方法可以成为一个完整的服务器端到端应用程序?任何指向正确方向的资源都将受到高度赞赏。我现在正在看this document
最近的公告是 API 网关自定义授权方:http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html
"you can control access to your APIs using bearer token authentication strategies, such as OAuth or SAML. To do so, you provide and configure a custom authorizer, a Lambda function you own, for API Gateway to use to authorize the client requests for the configured APIs"
另一个我认为是在自定义授权器发布之前编写的好资源:https://auth0.com/docs/integrations/aws-api-gateway/part-2
AWS API 网关也可以使用 API 密钥进行身份验证。 请按照以下步骤操作:-
- 在 API 网关的资源方法中设置 API 密钥。
- 创建使用计划并添加关联的 API 个阶段
- 创建 API 密钥并与使用计划相关联。
之后调用 API 网关时需要传递 API 密钥 作为页眉。
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(new MediaType[]{MediaType.APPLICATION_JSON}));
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("x-api-key", apiKey);