Spring Security + Struts 1.2集成 [英] Spring security + Struts 1.2 integration

查看:104
本文介绍了Spring Security + Struts 1.2集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,其中使用了struts1.2和ejb2.1,现在我想在其中使用LDAP服务器添加spring安全性. 如何将 Spring Security 与struts1.2集成?

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?

推荐答案

集成应该与任何其他Web应用都相同.

Integration shouldn't be different than any other web app.

  1. 您需要jar或maven依赖的spring-security依赖.我将发布Maven依赖项,如果您不使用Maven,则可以从此处查找jar:

  2. 您需要在web.xml中定义的FilterChainProxy:

  3. 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>
    

  4. 您需要在web.xml中定义的spring上下文位置:

  5. 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>
    

  6. 您需要在web.xml中定义的ContextLoaderListener:

  7. You need the ContextLoaderListener defined in your web.xml:

    <listener>
      <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    

  8. 最后,对于基本的安全配置,您可以查看应该这样做.

    这篇关于Spring Security + Struts 1.2集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆