Python SAML OneLogin - 如何支持多个身份提供者

Python SAML OneLogin - How to support multiple Identity Providers

我对 SAML 比较陌生,遇到了 OneLogin Python SAML 库。我能够启动它并且 运行 我的网络应用程序是服务提供商 (SP),OneLogin 是身份提供商 (Idp)。

我也希望能够添加对其他身份提供者的支持。但是,我发现 python-saml 库正在使用 settings.json 来获取 Idp 信息。我在他们的 Github 项目中查看了以下问题,但无法获得可行的解决方案: [1] https://github.com/onelogin/python-saml/issues/64 [2] https://github.com/onelogin/python-saml/issues/52

有没有人成功使用这个库来支持多个身份提供者?

这是 answered in the git repo:

The toolkit was not initially designed to be used with multiple IdPs, instead with the OneLogin IdP, but you can with a little effort support multiple IdPs.

In the toolkit you will see 2 demos (django, flask) that uses a settings.js file that contain a json object.

In order to support multiple IdPs you can store each IdP-SP data on different files or store different json objects on a database.

之后,由您的应用程序提供一种将不同租户绑定到不同 IDP 的机制。大多数人通常将他们的应用程序配置为通过子域 (sometenant.myapp.com) 或 URL (www.myapp.com/sometenant) 执行此操作 - 为每个租户配置不同的设置

完成后,SAML 就是 SAML,它应该可以与支持它的任何 IDP 一起使用。