美文网首页
AbstractSecurityInterceptor与Abst

AbstractSecurityInterceptor与Abst

作者: 光小月 | 来源:发表于2019-10-20 09:34 被阅读0次
  1. AbstractSecurityInterceptor查看类,主要是授权,关键查看实现类,
    FilterSecurityInterceptor,这是一个filter,执行doFilter中,会调用super.授权方法,

  2. AbstractAuthenticationProcessingFilter查看类,主要是filter, 执行doFilter方法,会调用attemptAuthentication()方法,
    这是调用实现类UsernamePasswordAuthenticationFilter.attemptAuthentication(), 会获取UsernamePasswordAuthenticationToken,
    同时获取authenticationManager,执行getAuthenticationManager().authenticate(authRequest)方法, 调用实现类ProviderManager
    执行,又会调用AuthenticationProvider的实现类AbstractUserDetailsAuthenticationProvider去执行
    provider.authenticate(authentication)方法,会调用retrieveUser(username, UsernamePasswordAuthenticationToken),
    会调用继承类daoAuthenticationProvider.retrieveUser方法,会调用getUserDetailsService().loadUserByUsername(username),
    上面这个是用于存储user信息与权限信息。
    所有说这两个类/接口最后都是Filter在调用。

    1. 实现动态的配置权限可以继承AbstractSecurityInterceptor类,重写doFilter方法,注意要注入权限类FilterInvocationSecurityMetadataSource,
      和setAccessDecisionManager(AccessDecisionManager)

相关文章

网友评论

      本文标题:AbstractSecurityInterceptor与Abst

      本文链接:https://www.haomeiwen.com/subject/exuomctx.html