`

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

    1.在auto-configtrue,未自定义filter时,下列用法是可行的.
  
<remember-me key="123456" token-validity-seconds="1209600"/>

    ,解决remeber失效问题,如下操作.配置remeberservice,以及remember.provider.
  
    ,最重要的就是,记得注入.自定义的loginfilter中,以及authentication-manager中.
  


如果有疑问,可以联系本人QQ1286814049
  • 大小: 107.3 KB
  • 大小: 76.5 KB
  • 大小: 69.5 KB
  • 大小: 21.5 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics