如何使用弹簧安全性保护混合Spring MVC + Flex应用程序

我试过在Spring论坛上问这个问题( http://forum.springsource.org/showthread.php?109948-Problem-configuring-spring-security-3.1-with-hybrid-Spring-MVC-Flex-application )但是没有得到回应。

我正在开发一个Web应用程序,它具有内置Flex的(最终用户)用户界面和使用Spring MVC构建的管理用户界面。 我正在尝试保护两个接口,并且可以让每个接口单独工作,但不能一起工作。

我正在使用带有Spring Security 3.1RC1和Spring 3.1M1的spring-flex-core 1.5.0的快照构建

                                   

如果我只包含没有pattern属性的第一个http标记,则flex UI似乎使用Spring安全性成功进行身份validation。 但是,如果我包含所有标签,那么根据我是否使用,我会得到两个错误之一

    

这使

 SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: The filter chain map already contains this request matcher [Root bean: class [org.springframework.security.web.util.AnyRequestMatcher]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]. If you are using multiple  namespace elements, you must use a 'pattern' attribute to define the request patterns to which they apply. 

要么

     

结果

 SEVERE: Servlet /apollo threw load() exception org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.springframework.security.web.authentication.session.SessionAuthenticationStrategy] is defined: expected single matching bean but found 2: [org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy#0, org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy#1] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:796) 

我显然遗漏了一些东西,但是当Spring Flex文档描述如何在servlet级别配置混合MVC + Flex应用程序时,它似乎只从仅灵活应用程序的角度来考虑安全性。

任何人都可以建议我做错了什么?

谢谢

戴夫

我在处理同一个问题之前使用的一件事是拥有2个独立的DispatcherServlet:

  org.springframework.web.context.ContextLoaderListener   flex org.springframework.web.servlet.DispatcherServlet 1   flex /messagebroker/*   spring-mvc org.springframework.web.servlet.DispatcherServlet 1   spring-mvc /spring/*  

您还需要通过将MVC路径修改为/spring/...来更新安全配置/spring/...

我几乎可以肯定,当您使用SpringDS而不是BlazeDS时,这不是最佳解决方案。 必须有一个更优化的方式!

您也可以尝试删除:

    

而不是尝试使用这个:

        

请记住,身份validation应该通过Flex客户端上的channelSet完成!