In the official document of the Springside 3, the security framework uses spring Secure 2.0. At first glance, startled me, thought Acegi so quickly was eliminated. Search engine, found that the original Spring Security 2.0 is Acegi 2.0. The hanging heart put it down. Although Springside 3 's profile about Acegi looks unfamiliar, everything is relieved after reading the official document of Acegi 2.0.
First of all, to talk about the basics of Acegi, ACEGI structure is more complex, but I hope that the following words can make it clear. As you all know, if you want to protect the Web resources, the best way is filter, in order to protect the method call, the best way is AOP. Acegi the protection of Web resources, is realized by the filter. The following figure:
In general, our filter is configured in Web.xml, but Acegi is not the same, it is configured in Web.xml is only a proxy, and the real effect of the filter is as a bean configuration in spring. The agents in the Web.xml, in turn, call these beans to protect the Web resources, and these filter is managed as a bean by spring, so it's easy to implement AOP.
Acegi provides a lot of filter, there are more than 10, one one to learn more complex. But for our web developers, there are only a few that are commonly used, as shown in the following image, marked by the red circle:
From top to bottom, they realize the function is 1, the establishment must be HTTPS connection, 2, from the session to extract the user's authentication information 3, exit login; 4, login; 5, remember the user; 6, all applications must be configured with this filter.
In general, we write a Web application only need to familiarize ourselves with these few filter, if you do not need HTTPS connection, even the first is not familiar. But some people will wonder how these filter links to my database. Don't worry, these filters do not directly deal with the user's authentication, nor directly deal with the user's authorization, but to the authentication manager and decision manager. The following figure: