spring boot security csrf ignore
2016-05-20 16:35
519 查看
在一个工程中使用了spring boot security csrf ,
工程中有一部分是api,通过url进行调用,并且要求使用post请求
那么麻烦来了,使用了csrf,调用api的请求被拒了,原因就是没有csrf,认为session过期了
怎么绕过去呢
public class SecurityConfig extends WebSecurityConfigurerAdapter{
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.and().csrf().ignoringAntMatchers("/api/**")
这样就好了,看来spring做的东西非常到位呀
工程中有一部分是api,通过url进行调用,并且要求使用post请求
那么麻烦来了,使用了csrf,调用api的请求被拒了,原因就是没有csrf,认为session过期了
怎么绕过去呢
public class SecurityConfig extends WebSecurityConfigurerAdapter{
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.and().csrf().ignoringAntMatchers("/api/**")
这样就好了,看来spring做的东西非常到位呀
相关文章推荐
- Spring中配置activeMQ(String类型的消息)
- java hql case when 的用法
- eclipse 常用快捷键
- java 面向对象练习题9
- Java类和对象11
- ZooKeeper示例 分布式锁
- java 面向对象练习题8
- Spring 中context.start作用
- java.util.Date、java.sql.Date、java.sql.Time、java.sql.Timestamp区别和总结
- java 类和对象10
- struts2+spring+mybatis整合小案例
- Apaache CXF 2.7 与Spring 3.0.7 集成
- JAVA线程 -- wait notify notifyAll
- spring boot controller路由 url 扫描不到问题
- java设计模式
- java 注解——使用详解
- Java类和对象9
- 关于javah编译.h头文件时出现的问题总结
- Java图片上传实现代码
- RxJava+Retrofit框架Demo