简体   繁体   English

Azure API 管理 - 认证和授权与底层服务同步

[英]Azure API Management - Authenticate and Authorization sync with underlying services

I am new to Azure API Management and will be happy to receive suggestion and advise on my implementation.我是 Azure API Management 的新手,很高兴收到有关我的实施的建议和建议。

I am developing a B2B Api Channel for 3rd parties to call my services via the API Management (APIM) Gateway.我正在开发一个 B2B Api 通道,供第三方通过 API 管理 (APIM) 网关调用我的服务。 On the APIM developers portal I can onboard new clients and generate API key.在 APIM 开发人员门户上,我可以加入新客户端并生成 API 密钥。 My struggle is how best to figure out at the underlying services who is calling?我的难题是如何最好地弄清楚谁在调用底层服务?

I have considered add the API Key generated in the APIM to a database which the underlying service will call to authenticate, however, the implementation will be manual and will not be in sync when the 3rd party client goes to APIM and regenerate a new API key.我已经考虑将 APIM 中生成的 API 密钥添加到底层服务将调用以进行身份验证的数据库,但是,当第 3 方客户端转到 APIM 并重新生成新的 API 密钥时,实现将是手动的并且不会同步.

What I want is a solution that auto syncs authorization and authentication between APIM and the underlying services.我想要的是一种在 APIM 和底层服务之间自动同步授权和身份验证的解决方案。

Since API keys can be replaced, you better rely on IDs to identify clients.由于可以替换 API 密钥,因此您最好依靠 ID 来识别客户端。

You can pass a client ID to a backend in a header: https://stackoverflow.com/a/42277313/2579733您可以将客户端 ID 传递到 header 中的后端: https://stackoverflow.com/a/42277313/2579733

Now how do you correlate APIM's client IDs with your backend's client IDs?现在,您如何将 APIM 的客户端 ID 与后端的客户端 ID 关联起来?

If there are only a few clients, you can probably update that association in your backend's database manually.如果只有几个客户端,您可能可以手动更新后端数据库中的该关联。 If you can use the clients's email to connect the APIM client and your backend client, that's even easier (you're done).如果您可以使用客户端的 email 来连接 APIM 客户端和您的后端客户端,那就更容易了(大功告成)。

If you will need to register many clients and the manual approach is not feasible... One way to do it is with Delegated Authentication :如果您需要注册许多客户端并且手动方法不可行......一种方法是使用Delegated Authentication

Delegation allows you to use your existing website for handling developer sign in/sign up and subscription to products, as opposed to using the built-in functionality in the developer portal.委托允许您使用现有网站来处理开发人员登录/注册和订阅产品,而不是使用开发人员门户中的内置功能。 It enables your website to own the user data and perform the validation of these steps in a custom way.它使您的网站能够拥有用户数据并以自定义方式执行这些步骤的验证。

I never used it but it seems you can transfer the responsibility of creating new clients to a backend service (developed by you).我从未使用过它,但似乎您可以将创建新客户端的责任转移到后端服务(由您开发)。

This way you have access to client emails, you generate IDs and can store the ID relationship in the backend as necessary.通过这种方式,您可以访问客户电子邮件、生成 ID 并可以根据需要将 ID 关系存储在后端。

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

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