我是 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
有没有人成功地使用这个库来支持多个身份提供者?
最佳答案
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.
之后,由您的应用程序提供一种将不同租户绑定(bind)到不同 IDP 的机制。大多数人通常将他们的应用程序配置为通过子域 (sometenant.myapp.com) 或 URL (www.myapp.com/sometenant) 执行此操作 - 为每个租户配置不同的设置
完成后,SAML 就是 SAML,它应该可以与支持它的任何 IDP 一起使用。
关于Python SAML OneLogin - 如何支持多个身份提供者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43684574/