1.

Can you explain what is DelegatingFilterProxy in spring security?

Answer»

A servlet filter must be declared in the WEB.xml file so that it can be invoked before the REQUEST is passed on to the actual Servlet class. DelegatingFilterProxy is a servlet filter embedded in the spring context. It ACTS as a bridge between web.xml (web application) and the application context (Spring IoC Container). DelegatingFilterProxy is a proxy that delegates an INCOMING request to a group of filters (which are not managed as spring beans) provided by the Spring web framework. It provides full access to the Spring context's life cycle machinery and dependency injection.

Whenever a request reaches the web application, the proxy ensures that the request is delegated to Spring Security, and, if everything goes smoothly, it will ensure that the request is DIRECTED to the right resource within the web application. The following example demonstrates how to configure the DelegatingProxyFilter in web.xml: 

 <?xml version="1.0" encoding="UTF-8"?> <web-app> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class> org.springframework.web.filter.DelegatingFilterProxy </filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>


Discussion

No Comment Found