View RSS Feed

Spring Framework

Configuring Spring Security

Rate this Entry
by , 11-27-2011 at 11:45 PM (1525 Views)
In the last tip, I introduced Spring Security and outlined the modules that are available. In this tip, we will look at configuring namespaces. Using Spring, the nice thing about Spring Security is that all the security elements are configured as beans in the application context. It is not uncommon to have a Acegi configuration containing dozens of bean declarations that span multiple pages.

Another nice feature is that Spring Security has its own security-specific namespace to simplify the security configuration in Spring. The namespace, along with some sensible default behavior, can significantly reduce the typical security configuration to about a dozen line of XML.

So if you are looking to use Acegi, the next thing you should do is to include the security namespace in the XML file by adding the namespace declaration:

Java Code:
<beans:beans xmlns="" 
<-- Put your security elements here
In this configuration, I have made the security namespace into the primary namespace. This allows for you to avoid adding security: prefixes on all of the elements. In the next tip, we will look at how to secure web requests.

Submit "Configuring Spring Security" to Facebook Submit "Configuring Spring Security" to Digg Submit "Configuring Spring Security" to Submit "Configuring Spring Security" to StumbleUpon Submit "Configuring Spring Security" to Google