spring-mvc - Cannot resolve variable _csrf in Spring MVC Application
问题描述
i have been trying to add xss protection via including the code
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
While execution it passes
<input type="hidden" name="" value=""/>
My SecurityConfig File is
@Configuration
@EnableWebSecurity
public class DemoSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/app/")
.loginProcessingUrl("/app/login")
.permitAll();
}
}
Is there anything i want to add?
解决方案
推荐阅读
- makefile - 如何为 Ocaml 项目生成正确的 makefile
- c++ - 在 C++ 中定义包含 TTF_Font 变量的向量时出现“未定义大小”错误
- java - 导航组件:在移动到片段 B 时部分显示片段 A
- jpa - QueryDSL 的最新状态是什么?
- node.js - 从同一个类nodejs调用函数
- android - FAILURE:构建失败并出现异常。- 科尔多瓦
- r - 比较两个向量时运行相同的函数时出错
- github - Github:将回购转移到组织:“
合作者席位不足”? - java - 安装调试 apk 显示为两个应用程序?
- php - Ajax显示两个日期之间的天数(输入标签)而不提交