TODO詳細待展開web
AccessDecisionManager 檢查受權信息redis
AccessDecisionVoter子類: RoleVoter (org.springframework.security.access.vote) RoleHierarchyVoter (org.springframework.security.access.vote) ScopeVoter (org.springframework.security.oauth2.provider.vote) WebExpressionVoter (org.springframework.security.web.access.expression) ClientScopeVoter (org.springframework.security.oauth2.provider.vote) Jsr250Voter (org.springframework.security.access.annotation) AuthenticatedVoter (org.springframework.security.access.vote) AbstractAclVoter (org.springframework.security.access.vote) PreInvocationAuthorizationAdviceVoter (org.springframework.security.access.prepost)
AuthenticationEntryPoint子類: Http401AuthenticationEntryPoint (org.springframework.boot.autoconfigure.security) DelegatingAuthenticationEntryPoint (org.springframework.security.web.authentication) BasicAuthenticationEntryPoint (org.springframework.security.web.authentication.www) DigestAuthenticationEntryPoint (org.springframework.security.web.authentication.www) Http403ForbiddenEntryPoint (org.springframework.security.web.authentication) LoginUrlAuthenticationEntryPoint (org.springframework.security.web.authentication) OAuth2AuthenticationEntryPoint (org.springframework.security.oauth2.provider.error) HttpStatusEntryPoint (org.springframework.security.web.authentication)
Basic相關spring
Digest相關express
chain = {FilterChainProxy$VirtualFilterChain@10122} originalChain = {ApplicationFilterChain@10132} filters = {ApplicationFilterConfig[10]@10359} 0 = {ApplicationFilterConfig@10362} 指標統計 "ApplicationFilterConfig[name=metricsFilter, filterClass=org.springframework.boot.actuate.autoconfigure.MetricsFilter]" 1 = {ApplicationFilterConfig@10363} 設置編碼 "ApplicationFilterConfig[name=characterEncodingFilter, filterClass=org.springframework.boot.web.filter.OrderedCharacterEncodingFilter]" 2 = {ApplicationFilterConfig@10364} sleuth消息跟蹤 "ApplicationFilterConfig[name=traceFilter, filterClass=org.springframework.cloud.sleuth.instrument.web.TraceFilter]" 3 = {ApplicationFilterConfig@10365} method轉換 "ApplicationFilterConfig[name=hiddenHttpMethodFilter, filterClass=org.springframework.boot.web.filter.OrderedHiddenHttpMethodFilter]" 4 = {ApplicationFilterConfig@10366} 支持http的put和patch獲取form的參數 "ApplicationFilterConfig[name=httpPutFormContentFilter, filterClass=org.springframework.boot.web.filter.OrderedHttpPutFormContentFilter]" 5 = {ApplicationFilterConfig@10367} 上下文設置 "ApplicationFilterConfig[name=requestContextFilter, filterClass=org.springframework.boot.web.filter.OrderedRequestContextFilter]" 6 = {ApplicationFilterConfig@10368} 代理調用springSecurityFilterChain TODO "ApplicationFilterConfig[name=springSecurityFilterChain, filterClass=org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean$1]" 7 = {ApplicationFilterConfig@10369} 消息調用記錄,相似接口日誌 "ApplicationFilterConfig[name=webRequestLoggingFilter, filterClass=org.springframework.boot.actuate.trace.WebRequestTraceFilter]" 8 = {ApplicationFilterConfig@10370} 響應頭加入header:X-Application-Context "ApplicationFilterConfig[name=applicationContextIdFilter, filterClass=org.springframework.boot.web.filter.ApplicationContextHeaderFilter]" 9 = {ApplicationFilterConfig@10371} WebSocket支持 "ApplicationFilterConfig[name=Tomcat WebSocket (JSR356) Filter, filterClass=org.apache.tomcat.websocket.server.WsFilter]" pos = 7 n = 10 servlet = {DispatcherServlet@10361} servletSupportsAsync = true additionalFilters = {ArrayList@10344} size = 11 0 = WebAsyncManager加入SecurityContext上下文攔截處理 {WebAsyncManagerIntegrationFilter@10127} 1 = SecurityContext獲取和持久化,好比session中。{SecurityContextPersistenceFilter@10125} 2 = 支持向response寫入header {HeaderWriterFilter@10124} 3 = 支持登出操做 {LogoutFilter@10123} 4 = 有token則認證 {OAuth2AuthenticationProcessingFilter@10118} 5 = 獲取認證跳轉前緩存的請求{RequestCacheAwareFilter@10353} 6 = 請求對象中包裝認證對象從spring security獲取而不是web容器{SecurityContextHolderAwareRequestFilter@10354} 7 = 沒認證時,設置上下文爲匿名用戶對象{AnonymousAuthenticationFilter@10355} 8 = 用戶關聯session控制 {SessionManagementFilter@10356} 9 = filter異常處理。前面filter的異常,此時處理不了,好比認證過程 {ExceptionTranslationFilter@10357} 10 = 安全攔截器TODO {FilterSecurityInterceptor@10358} firewalledRequest = {RequestWrapper@10179} "FirewalledRequest[ org.apache.catalina.connector.RequestFacade@5a96a1]" size = 11 currentPosition = 5 debug = true
WebSecurityConfiguration加載全部SecurityConfigurer配置,並配置,但未實例化構建。WebSecurityConfiguration加載springSecurityFilterChain的Bean時,構建Filter對象。此時調用前面的SecurityConfigurer列表的init,調用configure(HttpSecurity http).apache
WebSecurityConfiguration 加載安全配置
具體springSecurityFilterChain()會將全部SecurityConfigurer 加載到WebSecurity中,進行構建緩存
SecurityConfigurer子類 SecurityConfigurerAdapter (org.springframework.security.config.annotation) ClientDetailsServiceConfigurer (org.springframework.security.oauth2.config.annotation.configurers) OAuth2ClientAuthenticationConfigurer in SsoSecurityConfigurer (org.springframework.boot.autoconfigure.security.oauth2.client) UserDetailsAwareConfigurer (org.springframework.security.config.annotation.authentication.configurers.userdetails) AbstractDaoAuthenticationConfigurer (org.springframework.security.config.annotation.authentication.configurers.userdetails) DaoAuthenticationConfigurer (org.springframework.security.config.annotation.authentication.configurers.userdetails) UserDetailsServiceConfigurer (org.springframework.security.config.annotation.authentication.configurers.userdetails) UserDetailsManagerConfigurer (org.springframework.security.config.annotation.authentication.configurers.provisioning) JdbcUserDetailsManagerConfigurer (org.springframework.security.config.annotation.authentication.configurers.provisioning) InMemoryUserDetailsManagerConfigurer (org.springframework.security.config.annotation.authentication.configurers.provisioning) DefaultInMemoryUserDetailsManagerConfigurer in AuthenticationManagerConfiguration (org.springframework.boot.autoconfigure.security) ResourceServerSecurityConfigurer (org.springframework.security.oauth2.config.annotation.web.configurers) AbstractHttpConfigurer (org.springframework.security.config.annotation.web.configurers) HttpBasicConfigurer (org.springframework.security.config.annotation.web.configurers) LogoutConfigurer (org.springframework.security.config.annotation.web.configurers) RememberMeConfigurer (org.springframework.security.config.annotation.web.configurers) RequestCacheConfigurer (org.springframework.security.config.annotation.web.configurers) ServletApiConfigurer (org.springframework.security.config.annotation.web.configurers) DefaultLoginPageConfigurer (org.springframework.security.config.annotation.web.configurers) SessionManagementConfigurer (org.springframework.security.config.annotation.web.configurers) PortMapperConfigurer (org.springframework.security.config.annotation.web.configurers) ExceptionHandlingConfigurer (org.springframework.security.config.annotation.web.configurers) HeadersConfigurer (org.springframework.security.config.annotation.web.configurers) CsrfConfigurer (org.springframework.security.config.annotation.web.configurers) JeeConfigurer (org.springframework.security.config.annotation.web.configurers) AnonymousConfigurer (org.springframework.security.config.annotation.web.configurers) ChannelSecurityConfigurer (org.springframework.security.config.annotation.web.configurers) CorsConfigurer (org.springframework.security.config.annotation.web.configurers) SecurityContextConfigurer (org.springframework.security.config.annotation.web.configurers) X509Configurer (org.springframework.security.config.annotation.web.configurers) AbstractAuthenticationFilterConfigurer (org.springframework.security.config.annotation.web.configurers) FormLoginConfigurer (org.springframework.security.config.annotation.web.configurers) OpenIDLoginConfigurer (org.springframework.security.config.annotation.web.configurers.openid) AbstractInterceptUrlConfigurer (org.springframework.security.config.annotation.web.configurers) UrlAuthorizationConfigurer (org.springframework.security.config.annotation.web.configurers) ExpressionUrlAuthorizationConfigurer (org.springframework.security.config.annotation.web.configurers) AuthorizationServerSecurityConfigurer (org.springframework.security.oauth2.config.annotation.web.configurers) ClientDetailsServiceBuilder (org.springframework.security.oauth2.config.annotation.builders) JdbcClientDetailsServiceBuilder (org.springframework.security.oauth2.config.annotation.builders) 1 in ClientDetailsServiceBuilder (org.springframework.security.oauth2.config.annotation.builders) InMemoryClientDetailsServiceBuilder (org.springframework.security.oauth2.config.annotation.builders) LdapAuthenticationProviderConfigurer (org.springframework.security.config.annotation.authentication.configurers.ldap) WebSecurityConfigurer (org.springframework.security.config.annotation.web) WebSecurityConfigurerAdapter (org.springframework.security.config.annotation.web.configuration) 1 in WebSecurityConfiguration (org.springframework.security.config.annotation.web.configuration) ResourceServerConfiguration (org.springframework.security.oauth2.config.annotation.web.configuration) ApplicationNoWebSecurityConfigurerAdapter in SpringBootWebSecurityConfiguration (org.springframework.boot.autoconfigure.security) ManagementWebSecurityConfigurerAdapter in ManagementWebSecurityAutoConfiguration (org.springframework.boot.actuate.autoconfigure) AuthorizationServerSecurityConfiguration (org.springframework.security.oauth2.config.annotation.web.configuration) H2ConsoleSecurityConfigurer in H2ConsoleSecurityConfiguration in H2ConsoleAutoConfiguration (org.springframework.boot.autoconfigure.h2) OAuth2SsoDefaultConfiguration (org.springframework.boot.autoconfigure.security.oauth2.client) ApplicationWebSecurityConfigurerAdapter in SpringBootWebSecurityConfiguration (org.springframework.boot.autoconfigure.security) IgnoredPathsWebSecurityConfigurerAdapter in SpringBootWebSecurityConfiguration (org.springframework.boot.autoconfigure.security) GlobalAuthenticationConfigurerAdapter (org.springframework.security.config.annotation.authentication.configurers) InitializeAuthenticationProviderBeanManagerConfigurer (org.springframework.security.config.annotation.authentication.configuration) InitializeUserDetailsBeanManagerConfigurer (org.springframework.security.config.annotation.authentication.configuration) InitializeUserDetailsManagerConfigurer in InitializeAuthenticationProviderBeanManagerConfigurer (org.springframework.security.config.annotation.authentication.configuration) SpringBootAuthenticationConfigurerAdapter in AuthenticationManagerConfiguration (org.springframework.boot.autoconfigure.security) BootGlobalAuthenticationConfigurationAdapter in BootGlobalAuthenticationConfiguration (org.springframework.boot.autoconfigure.security) InitializeUserDetailsManagerConfigurer in InitializeUserDetailsBeanManagerConfigurer (org.springframework.security.config.annotation.authentication.configuration) EnableGlobalAuthenticationAutowiredConfigurer in AuthenticationConfiguration (org.springframework.security.config.annotation.authentication.configuration)
WebSecurityConfigurer子類 WebSecurityConfigurerAdapter (org.springframework.security.config.annotation.web.configuration) WebSecurityConfiguration (com.huawei.billingcloud.sysmgmt.oauth) 1 in WebSecurityConfiguration (org.springframework.security.config.annotation.web.configuration) ResourceServerConfiguration (org.springframework.security.oauth2.config.annotation.web.configuration) ApplicationNoWebSecurityConfigurerAdapter in SpringBootWebSecurityConfiguration (org.springframework.boot.autoconfigure.security) ManagementWebSecurityConfigurerAdapter in ManagementWebSecurityAutoConfiguration (org.springframework.boot.actuate.autoconfigure) AuthorizationServerSecurityConfiguration (org.springframework.security.oauth2.config.annotation.web.configuration) H2ConsoleSecurityConfigurer in H2ConsoleSecurityConfiguration in H2ConsoleAutoConfiguration (org.springframework.boot.autoconfigure.h2) OAuth2SsoDefaultConfiguration (org.springframework.boot.autoconfigure.security.oauth2.client) ApplicationWebSecurityConfigurerAdapter in SpringBootWebSecurityConfiguration (org.springframework.boot.autoconfigure.security) IgnoredPathsWebSecurityConfigurerAdapter in SpringBootWebSecurityConfiguration (org.springframework.boot.autoconfigure.security)
ResourceServerConfiguration 加載資源服務器配置ResourceServerConfigurer。
同時自身做爲一個WebSecurityConfigurer被上面的WebSecurityConfiguration加載tomcat
RestTemplate 默認converter 0 = {ByteArrayHttpMessageConverter@8484} 1 = {StringHttpMessageConverter@8485} 2 = {ResourceHttpMessageConverter@8486} 3 = {SourceHttpMessageConverter@8487} 4 = {AllEncompassingFormHttpMessageConverter@8488} 5 = {Jaxb2RootElementHttpMessageConverter@8489} 6 = {MappingJackson2HttpMessageConverter@8490}
0 = {SpringBootWebSecurityConfiguration$IgnoredPathsWebSecurityConfigurerAdapter@11234} 1 = {ResourceServerConfiguration$$EnhancerBySpringCGLIB$$c6c322ec@8468} 2 = {SpringBootWebSecurityConfiguration$ApplicationNoWebSecurityConfigurerAdapter$$EnhancerBySpringCGLIB$$a64c52f7@11230}
0 = {SpringBootWebSecurityConfiguration$IgnoredPathsWebSecurityConfigurerAdapter@13290} 1 = {AuthorizationServerSecurityConfiguration$$EnhancerBySpringCGLIB$$2aaaf2bf@9227} 2 = {WebSecurityConfiguration$$EnhancerBySpringCGLIB$$f14e4087@13291} 3 = {SpringBootWebSecurityConfiguration$ApplicationNoWebSecurityConfigurerAdapter$$EnhancerBySpringCGLIB$$a7a04c53@13292}