Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » 技术文章库  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 [原创]实战Acegi:使用Acegi作为基于Spring框架的WEB应用的安全框架
youlq



CJSDN高级会员


发贴: 260
积分: 95
于 2005-12-06 10:50 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
最近项目使用Acegi作为安全框架的实现,效果不错,就写了这篇文章作为总结.

原文见:
http://www.blogjava.net/youlq/archive/2005/12/06/22678.html
实战Acegi:使用Acegi作为基于Spring框架的WEB应用的安全框架
对于任何一个完整的应用系统,完善的认证和授权机制是必不可少的。在基于SpringFramework的WEB应用中,
我们可以使用Acegi作为安全架构的实现。本文将介绍如何在基于Spring构架的Web应用中使用Acegi,并且详细介
绍如何配置和扩展Acegi框架以适应实际需要。

文章和代码下载:

http://www.blogjava.net/Files/youlq/Acegi.zip

论坛内下载:

Acegi.zip (101.64k)


youlq edited on 2005-12-06 15:14

Be tough!
作者 Re:[原创]实战Acegi:使用Acegi作为基于Spring框架的WEB应用的安全框架 [Re:youlq]
floater

Java Jedi

总版主


发贴: 3233
积分: 421
于 2005-12-06 11:15 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
timeout from here


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler, Refactoring - Improving the Design of Existing Code
作者 Re:[原创]实战Acegi:使用Acegi作为基于Spring框架的WEB应用的安全框架 [Re:youlq]
leowu2000



版主


发贴: 258
积分: 50
于 2005-12-06 13:35 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
不错,粗略看了一下,实用性上会不会缺一些东西?例如更复杂的扩展以及方便的使用,例如实际应用中碰到模块、权限、角色都是动态变动定义的时候,如何使用这个框架呢?(因为最近考虑把项目中这类功能提取出来,不知道acegi多大程度上能满足实际需要)

期待楼主更精彩的讲解。Thumbs up



Eclipse邮件列表
作者 Re:[原创]实战Acegi:使用Acegi作为基于Spring框架的WEB应用的安全框架 [Re:leowu2000]
youlq



CJSDN高级会员


发贴: 260
积分: 95
于 2005-12-06 15:13 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
leowu2000 wrote:
不错,粗略看了一下,实用性上会不会缺一些东西?例如更复杂的扩展以及方便的使用,例如实际应用中碰到模块、权限、角色都是动态变动定义的时候,如何使用这个框架呢?(因为最近考虑把项目中这类功能提取出来,不知道acegi多大程度上能满足实际需要)

期待楼主更精彩的讲解。Thumbs up


每个项目的情况都有所不同,在我所遇到的项目基本上Acegi都能够通过一定的扩展后满足要求.说实话,acegi的扩展性实在是很强.

碰到模块、权限、角色都是动态变动定义的时候我估计通过一定的剪裁扩展acegi还是可以满足需求的.当然,我还没有碰到这种情况,就不多妄言了.



Be tough!
作者 Re:[原创]实战Acegi:使用Acegi作为基于Spring框架的WEB应用的安全框架 [Re:youlq]
leowu2000



版主


发贴: 258
积分: 50
于 2005-12-06 16:49 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
最早时候,floater曾经说过,关于权限、认证这些控制基本上可以基于两个接口来扩充,但是acegi却把它搞得复杂无比。Smile 我觉得从抽象层次上来看的话,floater的话有道理的,不过实际应用当中,我们更希望的是有一些基于核心所做的一些sample扩展,方便我们使用,就像spring的那些辅助类那样。

等我好好看了之后,我们再讨论。



Eclipse邮件列表
作者 Re:[原创]实战Acegi:使用Acegi作为基于Spring框架的WEB应用的安全框架 [Re:leowu2000]
youlq



CJSDN高级会员


发贴: 260
积分: 95
于 2005-12-06 18:14 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
leowu2000 wrote:
最早时候,floater曾经说过,关于权限、认证这些控制基本上可以基于两个接口来扩充,但是acegi却把它搞得复杂无比。Smile 我觉得从抽象层次上来看的话,floater的话有道理的,不过实际应用当中,我们更希望的是有一些基于核心所做的一些sample扩展,方便我们使用,就像spring的那些辅助类那样。

等我好好看了之后,我们再讨论。


毫无疑问,acegi确实很复杂!我想主要是因为它的目的在于建立一个"普遍适应"的安全框架,要达到这个目的,一方面需要框架具有很好的结构,有利于实现具体功能的"可插拔",另一方面,又要把安全方面的各种功能的常见实现包含到其中.实际上,acegi里面的确包含了很多像spring的那些辅助类.就算你不用acegi,也可以参考他里面的某些功能实现.

另外,不同项目有不同特点,作为公司角度上看,还是希望把一些常用功能统一框架.另外,通过实际使用acegi我觉得代码量确实大大减少,而且应用的代码变得很"干净",主要的工作量还是spring的配置文件编写和调试.

BTW:我相信通过仔细看我的例子还是比较容易对acegi上手的.呵呵...


youlq edited on 2005-12-06 18:18

Be tough!
作者 Re:[原创]实战Acegi:使用Acegi作为基于Spring框架的WEB应用的安全框架 [Re:floater]
youlq



CJSDN高级会员


发贴: 260
积分: 95
于 2005-12-06 18:19 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
floater wrote:
timeout from here


hehe,我的英文不大行,floater 是说无法访问我的blog吗?



Be tough!
作者 Re:[原创]实战Acegi:使用Acegi作为基于Spring框架的WEB应用的安全框架 [Re:youlq]
floater

Java Jedi

总版主


发贴: 3233
积分: 421
于 2005-12-06 21:57 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
yes, 无法访问your blog, both from home and workplace.

From my experience, yes, we need only a few interfaces, just like spring web has only one core interface - Controller. And everything else is built around these core interfaces. And it should have the flexibility to handle both simple cases and complex cases.

抽象 is based on experience at large. Last time when I checked acegi, it seemed that acegi folks haven't seen as many different cases as I've seen. Hopefully they can improve it.

Nonetheless, it's good to see a piece of work in this area.



"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler, Refactoring - Improving the Design of Existing Code
作者 Re:[原创]实战Acegi:使用Acegi作为基于Spring框架的WEB应用的安全框架 [Re:floater]
youlq



CJSDN高级会员


发贴: 260
积分: 95
于 2005-12-07 09:42 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
floater wrote:
yes, 无法访问your blog, both from home and workplace.

呵呵,现在站内可以下载了.
From my experience, yes, we need only a few interfaces, just like spring web has only one core interface - Controller. And everything else is built around these core interfaces. And it should have the flexibility to handle both simple cases and complex cases.


呵呵,这种高度抽象的结构一是难度很大,没有"seen many different cases "的功力是不能完成的.另外,有了抽象结构后还需要大量的功能实现代码,这也是不小的工作量啊..

抽象 is based on experience at large. Last time when I checked acegi, it seemed that acegi folks haven't seen as many different cases as I've seen. Hopefully they can improve it.
Nonetheless, it's good to see a piece of work in this area.

嗯,acegi我用的版本是0.8.3,目前已经发布0.9版,相信会越来越完善的.



Be tough!
作者 Re:[原创]实战Acegi:使用Acegi作为基于Spring框架的WEB应用的安全框架 [Re:youlq]
floater

Java Jedi

总版主


发贴: 3233
积分: 421
于 2005-12-07 11:56 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Now I got it, thanks.

Very very good article, it's nice to see something like this.



"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler, Refactoring - Improving the Design of Existing Code
作者 Re:[原创]实战Acegi:使用Acegi作为基于Spring框架的WEB应用的安全框架 [Re:floater]
juweiping



元老


发贴: 252
积分: 230
于 2005-12-08 10:31 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
很好的Acegi入门文章,个人经验,Acegi最主要的好处是认证集成比较方便,详细、灵活的权限控制,以及如何与我们原来的成熟的权限控制结合是扩展的重点。想在实际项目中用好Acegi,主要是如何根据实际情况扩展。


作者 Re:[原创]实战Acegi:使用Acegi作为基于Spring框架的WEB应用的安全框架 [Re:youlq]
YuLimin

简单就是美

版主


发贴: 866
积分: 123
于 2005-12-23 16:30 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
好东东,在这里也有一篇不错的介绍文章

http://www.blogcn.com.cn/user1/2313/archives/2005/11792.shtml

Acegi简介
Acegi安全系统,是一个用于Spring Framework的安全框架,能够和目前流行的Web容器无缝集成。它使用了Spring的方式提供了安全和认证安全服务,包括使用Bean Context,拦截器和面向接口的编程方式。因此,Acegi安全系统能够轻松地适用于复杂的安全需求。
安全涉及到两个不同的概念,认证和授权。前者是关于确认用户是否确实是他们所宣称的身份。授权则是关于确认用户是否有允许执行一个特定的操作。
在Acegi安全系统中,需要被认证的用户,系统或代理称为"Principal"。Acegi安全系统和其他的安全系统不同,它并没有角色和用户组的概念。

Acegi系统设计
关键组件
Acegi安全系统包含以下七个关键的功能组件:
l Authentication对象,包含了Principal,Credential和Principal的授权信息。同时还可以包含关于发起认证请求的客户的其他信息,如IP地址。
2 ContextHolder对象,使用ThreadLocal储存Authentication对象的地方。
3 AuthenticationManager,用于认证ContextHolder中的Authentication对象。
4 AccessDecissionManager,用于授权一个特定的操作。
5 RunAsManager,当执行特定的操作时,用于选择性地替换Authentication对象。
6 Secure Object拦截器,用于协调AuthenticationManager,AccessDecissionManager,RunAsManager和特定操作的执行。
7 ObjectDefinitionSource,包含了特定操作的授权定义。
........



 当兵不后悔!后悔不当兵! 
超越黎明时空,追逐时代潮流!
人,是要靠自己的!简单就是美!
我的Java:http://www.Java2Class.net
我的Blog:http://YuLimin.ItEye.com

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923