spring security 4 对比spring security 3 对http缓存进行了禁止,需要开启,才能进行http静态资源缓存。
看官方文档
In the past Spring Security required you to provide your own cache control for your web application. This seemed reasonable at the time, but browser caches have evolved to include caches for secure connections as well. This means that a user may view an authenticated page, log out, and then a malicious user can use the browser history to view the cached page. To help mitigate this Spring Security has added cache control support which will insert the following headers into you response.
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Simply adding the <headers> element with no child elements will automatically add Cache Control and quite a few other protections. However, if you only want cache control, you can enable this feature using Spring Security’s XML namespace with the <cache-control> element and the headers@defaults-disabled attribute.
<http>
<!-- ... -->
<headers defaults-disable="true">
<cache-control />
</headers>
</http>
@EnableWebSecurity
public class WebSecurityConfig extends
WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
// ...
.headers()
.defaultsDisabled()
.cacheControl();
}
}
解决方案:
1. 直接关闭header 的设置
<headers disabled="true" />
2.开启缓存
<headers>
<cache-control disabled="true"/>
</headers>
分享到:
相关推荐
12.1设置MockMvc和Spring Security 104 12.2 SecurityMockMvcRequestPostProcessors 105 12.2.1使用CSRF保护进行测试 105 12.2.2在Spring MVC测试中以用户身份运行测试 106 12.2.3使用RequestPostProcessor在Spring ...
基于RBAC模型构建权限管理模块,并集成安全框架SpringSecurity,实现用户的认证和授权。 使用Spring Data集成缓存中间件Redis,加快访问速度。 使用Spring Data集成全文搜索搜索引擎ElasticSearch,实现文章信息的...
缓存是HTTP协议的一个强大功能,但由于某些原因,它主要用于静态资源,如图像,CSS样式表或JavaScript文件。本文重点给大家介绍在Spring Boot中实现HTTP缓存的方法,感兴趣的朋友跟随小编一起看看吧
4.4.1 静态资源映射 88 4.4.2 拦截器配置 89 4.4.3 @ControllerAdvice 91 4.4.4 其他配置 94 4.5 Spring MVC 的高级配置 98 4.5.1 文件上传配置 98 4.5.2 自定义HttpMessageConverter 101 4.5.3 服务器端推送技术 ...
4.4.1 静态资源映射 88 4.4.2 拦截器配置 89 4.4.3 @ControllerAdvice 91 4.4.4 其他配置 94 4.5 Spring MVC 的高级配置 98 4.5.1 文件上传配置 98 4.5.2 自定义HttpMessageConverter 101 4.5.3 服务器端推送技术 ...
4.4.1 静态资源映射 88 4.4.2 拦截器配置 89 4.4.3 @ControllerAdvice 91 4.4.4 其他配置 94 4.5 Spring MVC 的高级配置 98 4.5.1 文件上传配置 98 4.5.2 自定义HttpMessageConverter 101 4.5.3 服务器端推送技术 ...
技术选型 前端:angularJS + Bootstrap 后台:SSM( springmvc+...SpringSecurity, 跨域:cro s 支付:微信扫描 短信验证:阿里大于 密码加密:BCrypt 富文本:KindEditor 事务:声明式事务 任务调度:spring task
前端:angularJS + Bootstrap 后台:SSM(springmvc +...权限管理:SpringSecurity, 跨域:cros 支付:微信扫描 短信验证:阿里大于 密码加密:BCrypt 富文本:KindEditor 事务:声明式事务 任务调度:spring task
基于RBAC模型构建权限管理模块,并集成安全框架SpringSecurity,实现用户的认证和授权。 使用Spring Data集成缓存中间件Redis,加快访问速度。 使用Spring Data集成全文搜索搜索引擎ElasticSearch,实现文章信息的...
SpringSecurity + JWT 用户鉴权 Mybatisplus 持久化 Redis 缓存 netty-socketio 消息推送 swagger 生成接口文档 接口文档 http://localhost:8080/doc.html 配置文件 application.yaml 设置静态文件位置、AI端...
基于RBAC模型构建权限管理模块,并集成安全框架SpringSecurity,实现用户的认证和授权。 使用Spring Data集成缓存中间件Redis,加快访问速度。 使用Spring Data集成全文搜索搜索引擎ElasticSearch,实现文章信息的...
freemarker 单点登录:cas 权限管理:SpringSecurity, 跨域:cros 支付:微信扫描 短信验证:阿里大于 密码加密:BCrypt 富文本:KindEditor 事务:声明式事务 任务调度:spring task,有问题请留言
- static文件夹:前端静态资源,需独立部署 ### 本地开发运行部署 - 下载zip直接解压或安装git后执行克隆命令 `git clone https://github.com/AatroxC/WeCommunity.git` - 安装各组件并启动:Redis、ZooKee
使用Redis缓存存储菜单列表,使用SpringSecurity角色权限验证,使用WebSocket进行在线聊天,使用 FastDFS存储静态资源文件 实现的功能 实现了登录功能、职位管理、职称管理、部门管 理、操作员管理、员工管理、工资...
使用Spring+JPA+Velocity+Ehcache作为基础开发架构,应用SpringSecurity框架管理系统权限,结合URL重写技术静态化商城前台页面。 Shopping结合多年的电商开发经验及主流电商的功能特点,注重系统易用性、功能性、...
使用Spring+JPA+Velocity+Ehcache作为基础开发架构,应用SpringSecurity框架管理系统权限,结合URL重写技术静态化商城前台页面。 Shopping结合多年的电商开发经验及主流电商的功能特点,注重系统易用性、功能性、...
Java 分布式项(SSM、分布式Dubbo、全文检索Solr、Vue、Zookeeper、文件系统FastDFS、缓存Redis、单点登录CAS,权限控制Spring Security,跨域CORS) 技术选型 后端框架采用 Spring + SpringMVC + MyBatis + DubboX...
用于静态资源(例如js,css,图片等)的缓存克星... Spock单元和集成测试。 将fluentlenium与htmlunit一起用于UI回归测试。 去做 新功能正在添加。 运行本地mongoDB 运行本地docker run --rm --name local-mongo ...
--静态资源处理 技术选型 后端技术 技术 说明 官网 SpringBoot 容器+MVC框架 SpringSecurity 认证和授权框架 MyBatis ORM框架 MyBatisGenerator 数据层代码生成 PageHelper MyBatis物理分页插件 Swagger-UI 文档生产...
java版商城源码下载 TryMall 该项目旨在学习mall电商项目 组织结构 mall ├── mall-common -- 工具类及通用代码 ├── ...MyBatisGenerator生成的数据库操作代码 ...SpringSecurity封装...静态资源服务器 Docker 应用容