问题描述
我有一个托管在 Azure 应用服务中的后端 API.我想使用 Azure API 管理作为此后端 API 的前端,并已在 Azure 中成功配置了它.我已将 API 管理配置为在访问此后端 API 时使用 OAuth,当客户端通过 Azure API 管理端点访问 API 时该 API 有效,但是如何防止人们直接访问后端 API 端点,以便仅来自 API 管理端点的调用是允许吗?
I have a backend API that is hosted in Azure app service. I want to use Azure API management as the front end to this backend API and have successfully configured this in Azure. I have configured API management to use OAuth when accessing this backend API which works when clients access the API through the Azure API management endpoints, but how do I prevent people from accessing the backend API endpoints directly so that only calls from the API management endpoints are allowed?
推荐答案
有几个不同安全级别的选项:
There are a few options of various levels of security:
- 共享密钥 - 在 APIM 中设置具有特定值的特定标头,并在后端检查该值.
- 托管身份 - 您可以在 APIM 服务中启用托管身份并将其令牌发送到您的后端,以便您对其进行验证.
- IP 过滤器 - 检查 APIM IP 作为后端的来源.
- 客户端证书身份验证 - 将客户端证书身份验证上传到 APIM,并将其附加到后端的每个请求.在后端检查该证书.
- VNET - 将 APIM 和您的后端放入同一个 VNET 并阻止从外部访问后端.
这篇关于如何防止直接访问托管在 Azure 应用服务中的 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!