在Okta创建了一个用于本地测试的saml应用程序。Django side我使用插件django_saml2_auth (https://github.com/fangli/django-saml2-auth)来验证Okta。
当我从Okta app打开应用程序时,Django抛出下面的错误;
Forbidden (CSRF cookie not set.): /
[03/Aug/2021 12:45:23] "POST / HTTP/1.1" 403 2870
Forbidden (403)
CSRF verification failed. Request aborted.
You are seeing this message because this site requires a CSRF cookie when submitting forms. This cookie is required for security reasons, to ensure that your browser is not being hijacked by third parties.
If you have configured your browser to disable cookies, please re-enable them, at least for this site, or for “same-origin” requests.
实际上主页( '/‘)没有任何用于csrf验证的表单,但是okta尝试在’/‘上发布,但在csrf上失败了。遵循此链接https://github.com/fangli/django-saml2-auth/issues/30#issuecomment-438056798,并在okta中添加了“可请求的urls”,但问题仍然存在。
Okta配置
GENERAL
Single Sign On URL http://127.0.0.1:8000/
Requestable SSO URLs
URL Index
http://127.0.0.1:8000/ 0
http://127.0.0.1:8000/saml2_auth/acs/ 1
http://127.0.0.1:8000/accounts/login/ 2
Recipient URL http://127.0.0.1:8000/
Destination URL http://127.0.0.1:8000/
Audience Restriction http://127.0.0.1:8000/saml2_auth/acs/
我错过了什么吗?有没有其他的saml插件可以用来集成django + Okta?
发布于 2021-11-03 22:38:13
在使用Okta和Django时,我得到了这个错误。
这可能是一个解决方案,因为我相信这个错误可能是由于多种原因而发生的,下面是为我解决上述错误的方法:
我在Okta中的SSO URL字段的末尾没有"/“。基本上,确保Okta上的SSO URL和实体ID与应用程序上settings.py上的类似字段相匹配。
https://stackoverflow.com/questions/68636553
复制相似问题