当前位置:主页>Flex>文章内容
  • Flex BlazeDS整合Spring在Tomcat 下的安全验证
  • 来源:stonywang的专栏 作者:stonywang 2008-06-14 【
FlashAs作品发表>>我要投稿 | FlashAs讨论区>>AS论坛
Flash Media Server学习站>>www.FMScn.com


Flex BlazeDS整合Spring在Tomcat下的安全验证

今天看了BlazeDS Developer Guide,在Tomcat在利用BASIC方法做了个安全验证的实例。Flex BlazeDS整合Spring在前面的例子中讲过了http://blog.csdn.net/stonywang/archive/2008/06 /12/2537730.aspx。

步骤如下:

(1) 在Web应用的web.xml中加入如下代码,关键是对/messagebroker/amf,也就是BlazeDS发的请求进行验证: <security-constraint> <web-resource-collection> <web-resource-name>Protected Channel</web-resource-name> <url-pattern>/messagebroker/amf</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <role-name>tomcat</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> </login-config> <security-role> <role-name>tomcat</role-name> </security-role>

(2)修改remoting-service.xml,对taxer进行验证。 <destination id="taxer">               <properties>                      <factory>spring</factory>                      <source>taxer</source>               </properties>               <security>                      <security-constraint>                             <auth-method>BASIC</auth-method>                             <roles>                                    <role>tomcat</role>                             </roles>                      </security-constraint>               </security>        </destination>

(3) 将D:\blazeds\resources\security\tomcat 下的flex-tomcat-common.jar拷贝到tomcat的 common/lib下;将flex-tomcat-server.jar拷贝到tomcat的server/lib下。

(4)Add <Valve className="flex.messaging.security.TomcatValve"/> tag to the Context Descriptors, 这个好像不加也没事。Tomcat5加上后无法启动,tomcat6可以启动。

(5)重启tomcat。访问:http://localhost:8080/SpringBlazeDSDemo /SpringBlazeDSDemo.html弹出对话框要求输入用户名和密码,输入tomcat/tomcat,成功登入。





上一篇:Flex中自定组件的事件处理   下一篇:使用鼠标滚轮切换TabNavigator的视图
  • 用户名:新注册) 密码: 匿名评论
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规)
FLASH源文件

Copyright © 2006-2008 flashas.net All Rights Reserved.
网站内容咨询: admin#flashas.net (#为@) 联系QQ:40777822 浙ICP备06033001号
(本网站最佳浏览解析度为1024*768, 建议使用IE 6.0或以上版本浏览器。)