Jsp Spring security csrf为空

Jsp Spring security csrf为空,jsp,spring-security,csrf,Jsp,Spring Security,Csrf,我有登录表单,我想保护它免受csrf攻击 我的spring-security.xml <sec:http auto-config="true" use-expressions="true"> ... <sec:csrf /> </sec:http> ... 我的jsp文件(使用分幅): 登录 我可以授权,但csrf为空: <input type="hidden" value="" name=""> 有人能帮我吗?您确

我有登录表单,我想保护它免受csrf攻击

我的spring-security.xml

<sec:http auto-config="true" use-expressions="true">
    ...
    <sec:csrf />
</sec:http>

...
我的jsp文件(使用分幅):


登录
我可以授权,但csrf为空:

<input type="hidden" value="" name="">


有人能帮我吗?

您确定JSTL设置正确吗?你试过用标签来代替吗?如果以下操作正常,则JSTL可能未正确设置:

<c:out value="${_csrf.parameterName}"/>


我只是想确定一下,你有没有积木?如果是这样,请确保您没有禁用登录表单上的安全性。

我已清除.m2目录并重新导入所有依赖项。这对我很有帮助。

如果您将应用security=“none”,则不会生成csrf令牌。页面将不会通过安全筛选器。使用角色匿名

我没有详细说明,但它对我有用

<http auto-config="true" use-expressions="true">
    <intercept-url pattern="/login.jsp" access="hasRole('ANONYMOUS')" />
    <!-- you configuration -->
</http>

只是为了确定您是否有任何块?如果是,请确保您没有禁用登录表单上的安全性。您确定jstl设置正确吗?
<http auto-config="true" use-expressions="true">
    <intercept-url pattern="/login.jsp" access="hasRole('ANONYMOUS')" />
    <!-- you configuration -->
</http>