重写LogouFilter类

import org.apache.shiro.web.filter.authc.LogoutFilter;

public class ShiroLogoutFilter extends LogoutFilter {

    @Override
    protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
        //清除HTTPSession的用户信息
        HttpServletRequest httpServletRequest=(HttpServletRequest) request;
        HttpSession session = httpServletRequest.getSession();
        if (session.getAttribute("user")!=null) {
            session.removeAttribute("user");
        }
        System.out.println("=HTTPSession用户数据被清空了=");
        
        return super.preHandle(httpServletRequest, response);
    }

}

 

相关文章:

  • 2021-10-20
  • 2022-12-23
  • 2021-06-24
  • 2021-10-30
  • 2021-08-12
  • 2022-01-16
  • 2022-12-23
猜你喜欢
  • 2022-01-05
  • 2022-12-23
  • 2021-07-24
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案