Spring Security autowiring

1, automatic assembly configuration class

org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration // class automatic assembly
  • 注册DefaultAuthenticationEventPublisher
org.springframework.boot.autoconfigure.security.SecurityProperties // properties corresponding to the properties configuration class
org.springframework.boot.autoconfigure.security.servlet.SpringBootWebSecurityConfiguration     // injection type configuration, for loading Spring Security customized configuration ( WebSecurityConfigurerAdapter: DefaultConfigurerAdapter )
org.springframework.boot.autoconfigure.security.servlet.WebSecurityEnablerConfiguration       // 开启@EnableWebSecurity手动装配
@EnableWebSecurity
  WebSecurityConfiguration:
  • Achieve ImportAware, BeanClassLoaderAware interfaces, loading debugEnabled (boolean), beanClassLoader (ClassLoader) properties
  • 注入objectObjectPostProcessor(ObjectPostProcessor<Object>)属性  (AutowiredBeanFactoryObjectPostProcessor
  • Registration AutowiredWebSecurityConfigurersIgnoreParents, the type used to obtain WebSecurityConfigurer Bean, and converted to List <WebSecurityConfigurer <Filter, WebSecurity >> format
  • Use objectObjectPostProcessor (AutowiredBeanFactoryObjectPostProcessor) create webSecurity (WebSecurity) property
  • Use AutowiredWebSecurityConfigurersIgnoreParents get List <WebSecurityConfigurer <Filter, WebSecurity >> Properties and assigned to webSecurityConfigurers
  • The WebSecurity webSecurityConfigurers value of all properties added to webSecurity
  • Registration DelegatingApplicationListener
  • Registration springSecurityFilterChain (Filter), create DefaultSecurityFilterChain, loading the default of 15 filters, create FilterChainProxy, proxy filter chain
  • 注册SecurityExpressionHandler<FilterInvocation>
  • 注册WebInvocationPrivilegeEvaluator(DefaultWebInvocationPrivilegeEvaluator)

  SpringWebMvcImportSelector:

  • Choose to register WebMvcSecurityConfiguration

  OAuth2ImportSelector:

  • Choose to register OAuth2ClientConfiguration

  @EnableGlobalAuthentication

    AuthenticationConfiguration

    • Import ObjectPostProcessorConfiguration, registered AutowiredBeanFactoryObjectPostProcessor
    • 注册AuthenticationManagerBuilder,EnableGlobalAuthenticationAutowiredConfigurer,InitializeUserDetailsBeanManagerConfigurer,InitializeAuthenticationProviderBeanManagerConfigurer

 

Guess you like

Origin www.cnblogs.com/pascall/p/11027072.html