【发布时间】:2020-07-23 01:59:24
【问题描述】:
当我从客户端向服务器发出 DELETE 请求时,我遇到了错误。
"CSRF Token 已与此客户端关联" .响应代码:403 和响应标头
{
"cache-control": "no-cache, no-store, max-age=0, must-revalidate",
"content-length": "45",
"content-type": "text/plain",
"expires": "0",
"pragma": "no-cache",
"referrer-policy": "no-referrer",
"x-content-type-options": "nosniff",
"x-frame-options": "DENY",
"x-xss-protection": "1 ; mode=block"
}
如下所示,从 java 代码中禁用 CSRF 后,问题已解决。
http.csrf( ).disable( );
但是禁用 CSRF 并不安全。您能帮我在不禁用 csrf 的情况下不要出现“CSRF Token has been associated to this client”错误吗?
谢谢
【问题讨论】:
标签: spring-security csrf csrf-token