spring_security自定义filter解决remember_me失效问题

    .最近项目要进行第三方登陆,由于项目用到了spring_security对于登陆方面需要自己重写 filter.
org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter

    .自己重写了这个filter,根据自己的业务需求去重写
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException

    .需要将 auto-config设为 false,因为你不能再靠spring_security来进行filter拦截了,将自己重写 loginfilter,替换 FORM_LOGIN_FILTER
spring_security自定义filter解决remember_me失效问题_第1张图片
    1.在 auto-configtrue,未自定义 filter时,下列用法是可行的.
  
<remember-me key="123456" token-validity-seconds="1209600"/>

    ,解决remeber失效问题,如下操作.配置remeberservice,以及remember.provider.
   spring_security自定义filter解决remember_me失效问题_第2张图片
    ,最重要的就是,记得注入.自定义的loginfilter中,以及authentication-manager中.
   spring_security自定义filter解决remember_me失效问题_第3张图片


如果有疑问,可以联系本人QQ1286814049

你可能感兴趣的:(spring,Security)