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) 注:以下内 ...
随机推荐
- IDEA2017-破解方法
@方法一 第一步:下载jar 包 地址:https://github.com/locationbai/registerIDEA_2017.3.2_jar 第二部:将下载好的jar放在idea安装目录下 ...
- hbase 定时备份
#!/bin/bash#su - hdfs <<EOFdata1=`date "+%Y%m%d%H%M%S"`data2="/user/news/hbase_ ...
- pm2-zabbix 安装与配置
官方GITHUB路径 https://github.com/greatcare/pm2-zabbix 环境要求,zabbix-agent zabbix-sender需要安装 npm安装要求 npm i ...
- as3.0控制声音大小
//加载声音 var sound:Sound=new Sound(); sound.load(new URLRequest("1.mp3")): //声明声道 var soundC ...
- POJ-3279.Fliptile(二进制状态压缩 + dfs) 子集生成
昨天晚上12点刷到的这个题,一开始一位是BFS,但是一直没有思路.后来推了一下发现只需要依次枚举第一行的所有翻转状态然后再对每个情况的其它田地翻转进行暴力dfs就可以,但是由于二进制压缩学的不是很透, ...
- phpword根据模板导出word
参考网址:http://phpword.readthedocs.io/en/latest/installing.html 在composer.json中添加 { "require" ...
- git--(3)分支 合并
git branch test //新建分支 git branch //列出分支 git branch -r //列出远程分支 git branch -m | -M oldbranch newbran ...
- linq to sql语句中转换数据类型和日期操作
System.Data.Entity.SqlServer.SqlFunctions.StringConvert System.Data.Entity.DbFunctions
- python 3.6.5 hashlib 和 hmac 模块
import hashlib m=hashlib.md5()# m=hashlib.sha256() m.update('hello'.encode('utf8'))print(m.hexdigest ...
- 转 C++函数返回值,你必须注意的问题
归根结底,C++所面临的问题要求它提供各种各样的机制以保证性能,也许,这辈子也见不到C++能安全有效的自己进行内存垃圾回收..... 老程序猿都会提醒菜鸟,注意函数的返回值,因为,很可能,你的函数返回 ...