SAML 和强制 SSL
SAML and forced SSL
我正在我的网站上实施 SAML 支持。我正在使用 OneLogin's Python SAML Toolkit in my Django app to do this. Everything works fine connecting to both a OneLogin test app and an Azure app when it's with my local machine, either http://127.0.0.1:8000 (completely local) or http://192.168.x.x:800(本地网络)。一旦我在我的登台服务器上尝试这个,它强制所有 URL 到 https,事情就失败了。 IE11 无法 POST 身份提供者响应中的任何数据,这很奇怪,通常我会从工具包中收到如下错误:
The response was received at https://dev.mysite.com:80/saml/connect/ instead of https://dev.mysite.com/saml/connect/
因此,虽然应该正确配置,但 IdP 最终会尝试 POST 返回到端口 80 上的暂存服务器,这让事情变得混乱。如果我从一开始就将其全部设置为使用端口 80,Chrome 会吓坏,因为它不信任 https://...:80 as secure. I can't find any docs or SO questions referencing this issue; all I've seen is this note in the OneLogin Python setup instructions:
Important: Ensure that your URLs begin with http, not https.
但没有解释为什么。我彻底糊涂了。
python-saml支持https或http。
您只需要正确设置请求的值,使用 prepare_django_request 方法检查此演示
( https://github.com/onelogin/python-saml/blob/master/demo-django/demo/views.py#L18 )
我正在我的网站上实施 SAML 支持。我正在使用 OneLogin's Python SAML Toolkit in my Django app to do this. Everything works fine connecting to both a OneLogin test app and an Azure app when it's with my local machine, either http://127.0.0.1:8000 (completely local) or http://192.168.x.x:800(本地网络)。一旦我在我的登台服务器上尝试这个,它强制所有 URL 到 https,事情就失败了。 IE11 无法 POST 身份提供者响应中的任何数据,这很奇怪,通常我会从工具包中收到如下错误:
The response was received at https://dev.mysite.com:80/saml/connect/ instead of https://dev.mysite.com/saml/connect/
因此,虽然应该正确配置,但 IdP 最终会尝试 POST 返回到端口 80 上的暂存服务器,这让事情变得混乱。如果我从一开始就将其全部设置为使用端口 80,Chrome 会吓坏,因为它不信任 https://...:80 as secure. I can't find any docs or SO questions referencing this issue; all I've seen is this note in the OneLogin Python setup instructions:
Important: Ensure that your URLs begin with http, not https.
但没有解释为什么。我彻底糊涂了。
python-saml支持https或http。
您只需要正确设置请求的值,使用 prepare_django_request 方法检查此演示 ( https://github.com/onelogin/python-saml/blob/master/demo-django/demo/views.py#L18 )