html form without csrf protection,尽管在表单中发送CSRF令牌,但不支持Spring Security CSRF 405方法POST...

我使用的是Spring框架版本4.3.5.RELEASE . Spring安全版是4.2.2.RELEASE .

我正面临一个与CSRF有关的奇怪问题 . 每当我提交一个表单(来自JSP文件), Sometimes it works fine, the form gets submitted without error but sometimes after submitting the form 时,它会显示 Http Status 405 ? Method not supported . 我也包含了csrf令牌,它们都隐藏在字段中,并将其作为查询字符串附加在表单's action' s标记中 .

这是我的项目中的示例POST表单:

action="http://localhost:8080/update/edit.html?${_csrf.parameterName}=${_csrf.token}">

这是我提交上述表格的控制器:

@RequestMapping(value = "/update/edit.html", method = RequestMethod.POST)

public String saveEdit(ModelMap map, @Valid @ModelAttribute(MODEL_KEY) DealerVisitVO dealerVisitVO, BindingResult result,

@RequestParam(required = false, name="followup") Boolean followup) {

//my codes here

}

The problem is coming random. 它有时有效,有时也无效 . 代码或表单没有变化 . 禁用CSRF不是一种可能的解决方案,因为这是我的客户的一项要求 .

如果有人能够解决,请帮助 .

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值