Security Rights Management Handbook http://www.family168.com/oa/springsecurity/html/
As we all know, a major improvement in Spring security for Acegi is that its configuration is greatly simplified. So if the configuration is based on the cumbersome configuration of acegi-1.x, then we might as well use the acegi instead of upgrading. So here, I'll combine an example to focus on how the Spring security 2 is configured to simplify.
Build a basic environment
First of all, we set up the basic development environment for the example, the way of setting up the environment, can refer to my another article: STRUTS2 Development environment Construction
The construction of the whole environment includes: creating the appropriate directory structure, adding the appropriate library, joining the basic jetty startup classes, adding basic configuration files, and so on. The final project structure can refer to my attachment.
Reference documentation
The main reference document here is the reference of spring security. On the internet there is a translation of its Chinese, the address is as follows: http://www.family168.com/tutorial/springsecurity/html/springsecurity.html
In addition, Springside has a more complete example, but based on the Acegi, I also see some of these implementations.
Spring Security Basic Configuration
Spring security is a permissions certification framework based on spring, and for those of you who are already familiar with spring and Acegi, the previous configuration should already be well understood. The next example will show you how spring security is based on the schema configuration.
Minimize configuration
1. Add the filter statement to the Web.xml file
XML code
<!-- Spring security Filter -->
<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>
<!-- Spring security Filter -->
<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>
This filter intercepts all URL requests and verifies these URL requests with spring security.
Note that the name Springsecurityfilterchain is the ID of an internal bean that was created by default in the namespace to handle web security. So you should not use this ID as your bean in your spring configuration file.
Unlike the Acegi configuration, Acegi needs to declare a spring bean as an implementation of the filter, and using spring security eliminates the need for additional definition of the bean and uses the