I have a application in which I used struts1.2 and ejb2.1 now I want to add spring security using LDAP server in it. How to integrate Spring Security with struts1.2?
Integration shouldn't be different than any other web app.
You need the spring-security dependencies either the jars or the maven dependencies. I'll post the maven dependencies, if you don't use maven you can look the jars up from here: mvn browser
<properties> <spring.version>3.0.1.RELEASE</spring.version> </properties> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-web</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-config</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-taglibs</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> <version>${spring.version}</version> </dependency>
You need the FilterChainProxy
defined in your web.xml
:
<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>
You need your spring context locations defined in your web.xml
:
<context-param> <param-name>contextConfigLocation</param-name> <param-value>WEB-INF/spring-contexts/myContextConfig.xml</param-value> </context-param>
You need the ContextLoaderListener defined in your web.xml
:
<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>
Finally for a basic security config you can have a look at the petclinic tutotial app .
That should do it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.