【问题标题】:Spring Security CSRF token does not have any valueSpring Security CSRF 令牌没有任何价值
【发布时间】:2022-07-29 08:57:41
【问题描述】:

我遵循了指南,但我总是以同一行 HTML 结束

<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>

这一行应该以“值”成为标记的方式发生变化,但它保持不变,我得到了完全相同的行。有人告诉我 Spring 会自动为 csrf 令牌添加这一行,但它不起作用。

【问题讨论】:

    标签: spring forms security token csrf


    【解决方案1】:

    请分享您的 spring 安全配置。你有没有在浏览器中获得 XSRF-TOKEN cookie。

    @覆盖 公共无效配置(HttpSecurity http)抛出异常{

        http.csrf().enable();
    }
    

    在你的jsp中尝试使用sec标签

    【讨论】:

      猜你喜欢
      • 2017-09-07
      • 1970-01-01
      • 2012-03-06
      • 2019-07-20
      • 2015-08-25
      • 2014-12-06
      • 2013-08-28
      • 2015-03-06
      • 2019-12-06
      相关资源
      最近更新 更多