Struts 2 application with basic Spring Security
In this section we will demonstrate basic Spring Security authentication with Struts 2. We will create a sample Struts 2 application and add Spring Security features to the action to make it secured. Only authenticated authorized users can access it.
Getting ready
Update the
Applicationcontext-security.xml
fileCreate a new dynamic project in Eclipse:
Struts2_Spring_BASIC_Security_Recipe2
How to do it...
Perform the following steps for integrating the Struts 2 application with Spring Security to implement basic authentication:
Modify the
applicationcontext-security.xml
file to support basic security:Applicationcontext-security.xml
:<beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3...