9、spring security拦截器之LogoutFilter
程序员文章站
2024-03-19 15:10:46
...
LogoutFilter:注销过滤器,默认的url是logout
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
//1、检测是否是注销的url,默认值是/logout
if (requiresLogout(request, response)) {
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (logger.isDebugEnabled()) {
logger.debug("Logging out user '" + auth
+ "' and transferring to logout destination");
}
//2、执行注销操作
this.handler.logout(request, response, auth);
//3、注销成功后的操作
logoutSuccessHandler.onLogoutSuccess(request, response, auth);
return;
}
chain.doFilter(request, response);
}
上一篇: 对逆波兰式(后缀表达式)求值详解
推荐阅读
-
9、spring security拦截器之LogoutFilter
-
Spring Boot 2.2.6 源码之旅三十五SpringMVC源码细节之拦截器
-
spring-security(三)java config-sample之hello world 博客分类: spring security springsecurity
-
spring-security(四)java config-sample之jdbc 博客分类: spring security securityspring
-
Spring Boot(四)之使用JWT和Spring Security保护REST API
-
Spring Boot(四)之使用JWT和Spring Security保护REST API
-
详解spring security之httpSecurity使用示例
-
详解spring security之httpSecurity使用示例
-
Spring Boot项目实战之拦截器与过滤器
-
Java开发之spring security实现基于MongoDB的认证功能