Django+Okta+Django_saml2_身份验证被禁止(未设置CSRF cookie)403

2024-05-16 23:24:39 发布

您现在位置:Python中文网/ 问答频道 /正文

在Okta中创建saml应用程序以进行本地测试。 Django方面,我正在使用插件Django_saml2_auth(https://github.com/fangli/django-saml2-auth)向Okta进行身份验证

当我从Okta应用程序打开应用程序时,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中添加了“可请求的URL”,但问题仍然是一样的

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集成


Tags: djangohttps插件auth应用程序httpurlfor