Robin's Programming World
I Love Programming As My Life!
BlogJava
首頁
新隨筆
聯系
聚合
管理
隨筆-193 評論-715 文章-1 trackbacks-0
BlazeDS結合Tomcat進行權限控制
環境:
BlazeDS 3.2.0.3978
Tomcat 6.0.29 (本例在Tomcat 5.5中不能正常運行,因為Tomcat 5.5的context部分的設計與6.0不一樣)
Java5
1,在service-config.xml中加入認證和角色(組)的定義:
<
security
>
<
login-command
class
="flex.messaging.security.TomcatLoginCommand"
server
="Tomcat"
/>
<
security-constraint
id
="trusted"
>
<
auth-method
>
Basic
</
auth-method
>
<
roles
>
<
role
>
tomcat
</
role
>
</
roles
>
</
security-constraint
>
<
security-constraint
id
="users"
>
<
auth-method
>
Basic
</
auth-method
>
<
roles
>
<
role
>
role1
</
role
>
<
role
>
tomcat
</
role
>
</
roles
>
</
security-constraint
>
</
security
>
需要說明的是,這里的security-constraint tag相當于一個角色組,其id屬性就是角色組的ID,如users角色組包含role1和tomcat兩個角色。
auth-method tag表示認證的方式,Basic即采用HTTP Basic認證方式,也可以自己實現認證方式,可調定為Custom,關于此種認證方式,我將在稍后分享給大家。
這些角色和用戶,均被定義在Tomcat的conf/tomcat-users.xml配置中:
<?
xml version='1.0' encoding='utf-8'
?>
<
tomcat-users
>
<!--
NOTE: By default, no user is included in the "manager" role required
to operate the "/manager" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary.
-->
<!--
NOTE: The sample user and role entries below are wrapped in a comment
and thus are ignored when reading this file. Do not forget to remove
<!.. ..> that surrounds them.
-->
<
role
rolename
="tomcat"
/>
<
role
rolename
="role1"
/>
<
role
rolename
="manager"
/>
<
user
username
="admin"
password
="admin"
roles
="manager"
/>
<
user
username
="tomcat"
password
="tomcat"
roles
="tomcat"
/>
<
user
username
="both"
password
="tomcat"
roles
="tomcat,role1"
/>
<
user
username
="role1"
password
="tomcat"
roles
="role1"
/>
</
tomcat-users
>
2,在remote-config.xml中配置具體的destination的權限約束:
<
destination
id
="Domain"
>
<
properties
>
<
source
>
com.robin.service.domain.DomainService
</
source
>
<
include-methods
>
<
method
name
="getAllDomains"
/>
<
method
name
="addOrUpdateDomain"
security-constraint
="trusted"
/>
</
include-methods
>
</
properties
>
<
security
>
<
security-constraint
ref
="users"
/>
</
security
>
</
destination
>
在此配置中,定義所有的方法只要是users角色組中的用戶即可訪問,但是addOrUpdateDomain方法需要trusted角色組中的用戶才能訪問。
3,將BlazeDS與Tomcat結合所依賴的lib復制到lib目錄中,包含flex-tomcat-common.jar和flex-tomcat-server.jar兩個JAR。
4,修改Tomcat目錄下的conf/context.xml文件,加入如下Context(在Tomcat5.5中無法成功):
<
Valve
className
="flex.messaging.security.TomcatValve"
/>
好了,就這么簡單,重啟Tomcat,即可驗證了。
總結一下:
1,引入了角色組的概念,這個比較好。
2,角色和用戶定義依賴于Tomcat,無法定義在如DBMS中,不方便修改。
3,跨平臺性不好。
4,資源與權限的映射關系在開發時已經綁定死,無法動態修改。
PS:2010.4.28. 分享給大家不依賴Tomcat容器實現認證與授權的例子,如有需要,請參考:《
BlazeDS自定義認證與權限控制
》
本Blog所有內容不得隨意轉載,版權屬于作者所有。如需轉載請與作者聯系(
fastzch@163.com
QQ:9184314)。
未經許可的轉載,本人保留一切法律權益。
一直以來,發現有某些人完全不尊重我的勞動成果,隨意轉載,提醒一下那些人小心哪天惹上官司。
posted on 2010-04-27 09:56
Robin's Programming World
閱讀(2348)
評論(0)
編輯
收藏
所屬分類:
Java
、
Flex & Flash
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關文章:
Ubuntu環境下Apache2與Tomcat集成
Spring 3 MVC and JSON example
Android Media Player 深入觀察
[轉]編寫高效的Android代碼
Android程序完全退出的三種方法
使用ANT批量編譯Flex應用和模塊(Use ANT to batch compiling application and modules of Flex)
Investigate getDeclaredMethod of Java Reflection
Eclipse空心J圖標的含義
Memcached Study Notes
BlazeDS自定義認證與權限控制
<
2010年4月
>
日
一
二
三
四
五
六
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
7
8
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(49)
給我留言
查看公開留言
查看私人留言
隨筆分類
(215)
.Net(1)
DB(8)
Flex & Flash(11)
Java(72)
OS(25)
RUP(1)
weblogic(3)
Webshere(16)
其它(50)
心情(2)
翻譯(1)
讀書(9)
轉載(16)
隨筆檔案
(181)
2014年8月 (1)
2014年4月 (1)
2014年2月 (2)
2014年1月 (1)
2012年11月 (1)
2012年9月 (2)
2012年7月 (1)
2012年6月 (3)
2012年1月 (2)
2011年12月 (4)
2011年10月 (1)
2011年8月 (3)
2011年7月 (2)
2011年4月 (1)
2010年11月 (2)
2010年10月 (1)
2010年9月 (2)
2010年8月 (5)
2010年7月 (1)
2010年5月 (2)
2010年4月 (7)
2010年3月 (7)
2009年12月 (6)
2009年10月 (1)
2009年9月 (1)
2009年8月 (2)
2009年6月 (3)
2009年5月 (2)
2009年4月 (2)
2009年2月 (3)
2009年1月 (4)
2008年11月 (1)
2008年10月 (2)
2008年9月 (9)
2008年8月 (4)
2008年7月 (5)
2008年5月 (2)
2008年4月 (1)
2008年3月 (3)
2008年2月 (1)
2008年1月 (7)
2007年12月 (6)
2007年11月 (6)
2007年10月 (3)
2007年9月 (1)
2007年8月 (6)
2007年7月 (4)
2007年6月 (2)
2007年5月 (3)
2007年3月 (1)
2007年2月 (1)
2007年1月 (3)
2006年12月 (7)
2006年10月 (1)
2006年8月 (3)
2006年7月 (1)
2006年6月 (5)
2006年4月 (6)
2006年3月 (2)
2006年2月 (3)
2006年1月 (1)
2005年11月 (5)
相冊
文章相關圖片
收藏夾
other
Friend Links
Tiger的Blog,專注于過程改進,項目管理,質量管理三個方向。
zrfunds
搜索
積分與排名
積分 - 754426
排名 - 60
最新評論
1.?re: XFire完整入門教程
樓主,請問你做過xfire使用spring的jdbc模板訪問數據庫的例子嗎,急求啊?xfire和spring的結合在不訪問數據庫時(就像你這個例子一樣)已經跑通了,但是需要使用jdbc時老出問題。謝謝
--fqjabc
2.?re: 一次JQuery性能優化實戰
不需要構建DOM
--bns
3.?re: Spring Security 3.x 完整入門教程
@過客
尊重人是最起碼的
--bns
4.?re: Flex中帶有三種狀態CheckBox的Tree的實現
帶有3種狀態CheckBox的樹形組件剛好用到
收了
--bns
5.?re: Spring Security 3.x 完整入門教程
AntUrlPathMatcher這個類所在jar包是哪個啊,是spring-security-core-tiger這個嗎?
--iechenyb
閱讀排行榜
1.?XFire完整入門教程(90497)
2.?Spring Security 3.x 完整入門教程(59173)
3.?使用XFire開發Web Service客戶端完整入門教程(52348)
4.?WebSphere6.1中使用Spring報cvc-elt.1: Cannot find the declaration of element 'beans'異常的解決辦法(24243)
5.?用MKVMerge GUI合并MKV文件(16686)
評論排行榜
1.?XFire完整入門教程(130)
2.?Spring Security 3.x 完整入門教程(67)
3.?使用XFire開發Web Service客戶端完整入門教程(33)
4.?VBA編程心得(24)
5.?JDK1.5API完整中文版CHM格式文檔發放(可下載)(22)
Powered by:
博客園
模板提供:
滬江博客
Copyright ©2025 Robin's Programming World
主站蜘蛛池模板:
久久不见久久见免费影院www日本
|
污网站在线观看免费
|
免费萌白酱国产一区二区三区
|
一级毛片免费播放男男
|
国产精品久免费的黄网站
|
亚洲av永久无码精品网址
|
免费爱爱的视频太爽了
|
国产成人综合久久精品亚洲
|
国产一级淫片a免费播放口之
|
精品国产_亚洲人成在线
|
亚洲国产精品尤物yw在线
|
亚洲精品无码久久毛片
|
fc2成年免费共享视频18
|
亚洲成a人片在线观看日本
|
男的把j放进女人下面视频免费
|
五月天网站亚洲小说
|
免费人成网站在线观看10分钟
|
亚洲中文字幕无码中文字
|
国产成人免费网站在线观看
|
亚洲精品综合久久中文字幕
|
无人在线直播免费观看
|
国产成人精品日本亚洲语音
|
亚洲国产成人精品91久久久
|
中文字幕日本人妻久久久免费
|
亚洲美女视频网站
|
日韩一区二区在线免费观看
|
国产男女爽爽爽免费视频
|
亚洲视频一区调教
|
女人与禽交视频免费看
|
jizz在线免费观看
|
久久精品国产亚洲av日韩
|
中文字幕人成无码免费视频
|
日本视频免费观看
|
亚洲精品国产成人专区
|
日本高清免费网站
|
免费的全黄一级录像带
|
亚洲色欲色欲www在线播放
|
久久国产成人精品国产成人亚洲
|
亚洲一级毛片免费看
|
伊人久久国产免费观看视频
|
亚洲网站视频在线观看
|