spring security 4.2后出现CouldnotverifytheprovidedCSRFtokenbecauseyoursessionwasnotfound
升级到spring security 4.2后,登录不了,出现下面的错误
WARN DefaultHandlerExceptionResolver:361 - Failed to bind request element: org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "CouldnotverifytheprovidedCSRFtokenbecauseyoursessionwasnotfound."
修改spring security配置文件后,解决,如下:
<http use-expressions="true" auto-config="true">
<form-login login-page="/login.do" always-use-default-target="false" />
<logout invalidate-session="true" logout-url="/logout.do" logout-success-url="/login.do"/>
<!-- 免登录验证,当session还在,防问是会自己登录 -->
<remember-me/>
<custom-filter before="FILTER_SECURITY_INTERCEPTOR" ref="myFilter"/>
<access-denied-handler ref="accessDeniedHandler"/>
<!-- 4.0以后默认打开csrf,不允许post,设置为不打开 -->
<csrf disabled="true"/>
<!-- 4.0以后X-Frame-Options的默认大多也是DENY,这种情况下,浏览器拒绝当前页面加载任何Frame页面 -->
<headers>
<frame-options policy="SAMEORIGIN"/>
</headers>
</http>
spring security 4.2后出现CouldnotverifytheprovidedCSRFtokenbecauseyoursessionwasnotfound的更多相关文章
- 浅谈spring security 403机制
403就是access denied ,就是请求拒绝,因为权限不足 三种权限级别 一.无权限访问 <security:http security="none" pattern ...
- oauth2 Spring Security
oauth2四种授权方式小结 http://www.ruanyifeng.com/blog/2019/04/oauth-grant-types.html 密码模式(resource owner pas ...
- spring security中动态更新用户的权限
在程序的执行过程中,有时有这么一种需求,需要动态的更新某些角色的权限或某些人对应的权限,当前在线的用户拥有这个角色或拥有这个权限时,在不退出系统的情况下,需要动态的改变的他所拥有的权限. 需求:张三 ...
- spring security使用自定义登录界面后,不能返回到之前的请求界面的问题
昨天因为集成spring security oauth2,所以对之前spring security的配置进行了一些修改,然后就导致登录后不能正确跳转回被拦截的页面,而是返回到localhost根目录. ...
- Spring Boot与Spring Security整合后post数据不了,403拒绝访问
http://blog.csdn.net/sinat_28454173/article/details/52251004 *************************************** ...
- request.getRemoteUser() Spring Security做权限控制后
一. request.getRemoteUser();//获取当前缓存的用户,比如Spring Security做权限控制后就会将用户登录名缓存到这里 request.getRemoteAddr(); ...
- Spring Security之多次登录失败后账户锁定功能的实现
在上一次写的文章中,为大家说到了如何动态的从数据库加载用户.角色.权限信息,从而实现登录验证及授权.在实际的开发过程中,我们通常会有这样的一个需求:当用户多次登录失败的时候,我们应该将账户锁定,等待一 ...
- Spring Security(08)——intercept-url配置
http://elim.iteye.com/blog/2161056 Spring Security(08)--intercept-url配置 博客分类: spring Security Spring ...
- Spring Security笔记:Hello World
本文演示了Spring Security的最最基本用法,二个页面(或理解成二个url),一个需要登录认证后才能访问(比如:../admin/),一个可匿名访问(比如:../welcome) 注:以下内 ...
随机推荐
- input type='number'时,maxlength属性无效
<input type="number" oninput="if(value.length>11)value=value.slice(0,11)" ...
- openstack(Pike 版)集群部署(六)--- Horizon 部署
一.介绍 参照官网部署:https://docs.openstack.org/horizon/pike/install/ 继续上一博客进行部署:http://www.cnblogs.com/we ...
- centos 7 下 Ceph 配置安装
一.环境介绍 系统: CentOS Linux release 7.3.1611 (Core) 硬盘: 系统盘:300GB*2-raid 1 OSD:600GB*4-raid 5 ceph ...
- ubuntu下java的安装即使用
1.首先在官方网站(点击可以下载)下载最新的JDK,要选用self extracting installer 2.在/usr/下新建java目录,把下载的文件放到这个目录下 sudo mkdir /u ...
- WebSphere Application Server中manageprofiles的使用
转自 https://www.cnblogs.com/lgfeng/archive/2013/02/21/2921215.html ---------------------------------- ...
- VIM常见命令
1.删除所有数据 进入到第1行按下d,然后输入G回车,此时内容被全部清除 2.替换 :s/vivian/sky/ 替换当前行第一个 vivian 为 sky:s/vivian/sky/g 替换当前行所 ...
- 160. Intersection of Two Linked Lists (List;Two-Pointers)
Write a program to find the node at which the intersection of two singly linked lists begins. For ex ...
- XFF的学习+修改源码--Are you in class
这几天有做天枢CTF的“Are you in class”的题目,虽然以前了解过XFF,但还是没有很好地应用,而且最后居然掉进了一个大坑,且听我细细讲来. 打开题目,首先有个提示“在不在学校主要看 ...
- 项目总结15:JavaScript模拟表单提交(实现window.location.href-POST提交数据效果)
JavaScript模拟表单提交(实现window.location.href-POST提交数据效果) 前沿 1-在具体项目开发中,用window.location.href方法下载文件,因windo ...
- 本地DNS解析
企业搭配本地域名,进行解析 2018年07月23日 09:31:46 阅读数:2 搭建dns服务器,可以进行域名解析,这样方便企业项目本地测试. 可以实现,输入域名访问本地服务器 一.安装软件 1.下 ...