In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "how is the construction process of SecurityFilterChain". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
The core Bean that Spring Security embeds into Servlet is a filter called springSecurityFilterChain. This filter is the core entry of Spring Security.
No matter what kind of Web application, Spring Security obtains "springSecurityFilterChain" from IOC. There is only one registration entry for this Bean. In the class WebSecurityConfiguration, the configuration object is opened by the annotation @ EnableWebSecurity.
@ Bean (name = AbstractSecurityWebApplicationInitializer.DEFAULT_FILTER_NAME) public Filter springSecurityFilterChain () throws Exception {... return webSecurity.build ();}
Builder mode: WebSecurity, built product is: Filter, specific type is FilterChainProxy
Public final class WebSecurity extends AbstractConfiguredSecurityBuilder implements SecurityBuilder, ApplicationContextAware {...}
Template method mode: AbstractConfiguredSecurityBuilder. The template method is the builder's build method. After templating, the doBuild method is called. DoBuild is still a template method.
Overrideprotected final O doBuild () throws Exception {synchronized (configurers) {buildState = BuildState.INITIALIZING; / /-initialization-beforeInit (); init (); buildState = BuildState.CONFIGURING; / /-configuration properties-beforeConfigure (); configure (); buildState = BuildState.BUILDING; / /-built products-O result = performBuild (); buildState = BuildState.BUILT Return result;}}
The core construction method, the performBuild method, is implemented in the subclass, where the build class is WebSecurity
@ Overrideprotected Filter performBuild () throws Exception {/ / chain length int chainSize = ignoredRequests.size () + securityFilterChainBuilders.size (); / / Construction of SecurityFilterChain List securityFilterChains = new ArrayList (chainSize); / / part I: from requests that do not require security: ignoredRequest for (RequestMatcher ignoredRequest: ignoredRequests) {securityFilterChains.add (new DefaultSecurityFilterChain (ignoredRequest)); part II: from requests for security: securityFilterChainBuilders for (SecurityBuilder)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.