Security 配置过滤器
配置 LoginInterceptor
@Service
public class LoginInterceptor implements Filter {@Overridepublic void init(FilterConfig filterConfig) throws ServletException {System.out.println("init");}@Overridepublic void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {chain.doFilter(httpServletRequest,httpServletResponse);}@Overridepublic void destroy() {System.out.println("完成了");}
在 SecurityConfig里面配置
@Autowired
private LoginInterceptor myFilterSecurityInterceptor;
@Overrideprotected void configure(HttpSecurity http) throws Exception {http.formLogin().loginPage("/authentication/require").loginProcessingUrl("/authentication/form").successHandler(myLoginAuthSuccessHandler).and().authorizeRequests().antMatchers("/authentication/require","/authentication/form","/**/*.js","/**/*.css","/**/*.jpg","/**/*.png","/**/*.woff2","/auth/*","/oauth/*","/login/**","/mylogout","/exit").permitAll().anyRequest().authenticated().and().anonymous().disable().exceptionHandling().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/login?error")).and().csrf().disable();http.addFilterBefore(myFilterSecurityInterceptor, FilterSecurityInterceptor.class);}
转载 https://www.51csdn.cn/article/360.html
Security 配置过滤器相关推荐
- Spring Security之过滤器链【探案】+源码剖析
Spring Security之过滤器链[探案] Spring Security常用过滤器介绍 过滤器是一种典型的AOP思想,关于什么是过滤器,就不赘述了,接下来咱们就一起看看Spring Secur ...
- Security配置
/*** Spring Security配置类*/ @Slf4j @Configuration @EnableGlobalMethodSecurity(prePostEnabled = true) p ...
- springboot _配置过滤器、拦截器、使用原生servlet
配置过滤器.拦截器.使用原生servlet 过滤器和拦截器的根本区别 过滤器是servlet规范规定的,只能用于web程序中,而拦截器是在spring容器中,它不依赖servlet容器. 拦截器属于S ...
- Spring Security配置错误
我最近看到Mike Wienser的SpringOne2GX谈论了Application Security Pitfalls . 如果您在Servlet容器上使用Spring的堆栈,这将非常有用,值得 ...
- 【Spring Security】WebSecurityConfigurerAdapter被deprecated怎么办?官方推荐新的Security配置风格总结
h 本期目录 背景 一. 前言 二. 配置HttpSecurity 三. 配置WebSecurity 四. 配置LDAP认证 五. 配置JDBC认证 六. In-Memory Authenticati ...
- SpringMvc框架配置过滤器
SpringMvc框架配置过滤器 本文以简单的登录过滤器为例 开发环境 jdk 8 idea2019.3.5 maven 3.6.3 spring-webmvc 5.1.9.RELEASE web.x ...
- 在web.xml中配置过滤器
在web.xml中配置过滤器 <filter> <filter-name>loginFilter</filter-name>//过滤器名称 <filter-c ...
- springmvc配置过滤器
post请求传中文的时候出现乱码,需要在xml中配置一些参数 <!-- 配置过滤器--><filter><filter-name>characterEncoding ...
- spring security 核心过滤器
2019独角兽企业重金招聘Python工程师标准>>> #14. Core Security Filter 有很多关键过滤器在spring 安全的项目中总是使用,所以我们可以查看这些 ...
最新文章
- android自带的nsd发现服务器,Android网络服务发现(NSD)协议的使用
- poj2480(利用欧拉函数的积性求解)
- java- WatchService监控
- Spring自学日志06(Aop)
- 修改linux服务器时间
- auto_ptr scoped_ptr shared_ptr weak_ptr unique_ptr
- 基于CNN的SEEG/EEG脑电数据处理分析
- 最新kali之bulk_extractor
- DataV-数据-api方式
- maven-聚合工程
- 全国大学生“高教杯”成图大赛——图错了如何修改
- 企业网络及应用层安全防护技术精要
- rap 接口管理 java_GitHub - ClassJava/rap2-delos: 阿里妈妈前端团队出品的开源接口管理工具RAP第二代...
- springboot:redis报错io.lettuce.core.RedisCommandExecutionException: ERR Client sent AUTH, but no passw
- php 远程读取excel,PHP远程读取excel文件,如何读取?
- php 做ui,如何制作ui
- SSH连接慢问题解决
- 数据挖掘算法之关联规则挖掘(二)FPGrowth算法
- matlab里open命令,OpenSEES学习笔记
- ADC/DAC理论信噪比SNR理解
热门文章
- 福禄克DSX2-5000 CH电缆认证测试仪的不同寻常之处
- 1.ps 橡皮差工具使用
- 深入理解public static ltTgt T max(Collectionlt? extends Tgt coll,Comparator lt? super Tgt comp)
- SAP PP组织结构及概念
- java oracle big5_Oracle字符集子集与超级的对应关系
- ImmunoChemistry丨ICT艾美捷MicroTiter平板设计说明书
- OpenCV——Delaunay三角剖分
- 如果一个巨蟹座的人开始忙了……
- 未能加载文件或程序集System.Data,Version=2.0.0.0和System.XML,Version=2.0.0.0解决方法
- 2021年茶艺师(中级)模拟考试题及茶艺师(中级)作业考试题库