12 第1页 | 共2 页下一页
返回列表 发新帖
查看: 2867|回复: 13
打印 上一主题 下一主题

spring acegi 官方例子1

[复制链接]

1026

主题

1

听众

6011

积分

高级设计师

Rank: 6Rank: 6

纳金币
5996
精华
1

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2011-7-29 17:53:17 |只看该作者 |倒序浏览










acegi安全是一个强大的,灵活的安全解决方案的企业软件,并特别着重于应用,利用spring。用acegi安全,为用户的应用与全面的认证,授权,例如基于职务的访问控制,通道安全和人类用户检测能力。(google 对acegid的翻译)

参考资料:http://www.tfo-eservices.eu/wb_tutorials/media/SpringAcegiTutorial/HTML/SpringAcegiTutorial-1_1-html.html

里面有一个例子:SpringAcegiTutorial,可以进行下载,并运行,做为一个实例,已经相当不错了。

讲述了admin ,user的登录问题。及权限控件,acegi 的配置。

这个例子是spring mvc + spring acegi 的例子,阅读前最好有spring mvc 的基础。这里只摘录简单的配置说明。
<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><!-- ****** START ACEGI Security Configuration *******-->

<!-- ======================== FILTER CHAIN ======================= -->



<!-- if you wish to use channel security, add "channelProcessingFilter," in front

of "httpsessionContextIntegrationFilter" in the list below -->

<bean id="filterChainProxy"

class="org.acegisecurity.util.FilterChainProxy">

<property name="filterInvocationDefinitionSource">

<value>

CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON

PATTERN_TYPE_APACHE_ANT

/**=httpSessionContextIntegrationFilter,formAuthenticationProcessingFilter,exceptionTranslationFilter,filterSecurityInterceptor

</value>

</property>

</bean>



<!-- Start Security filter config -->

<bean id="exceptionTranslationFilter"

class="org.acegisecurity.ui.ExceptionTranslationFilter">

<property name="authenticationEntryPoint">

<ref bean="formLoginAuthenticationEntryPoint" />

</property>

</bean>



<!-- Define filter to handle BASIC authentication -->

<bean id="basicProcessingFilter"

class="org.acegisecurity.ui.basicauth.BasicProcessingFilter">

<property name="authenticationManager">

<ref bean="authenticationManager" />

</property>

<property name="authenticationEntryPoint">

<ref bean="authenticationEntryPoint" />

</property>

</bean>



<!-- Define realm for BASIC login-->

<bean id="authenticationEntryPoint"

class="org.acegisecurity.ui.basicauth.BasicProcessingFilterEntryPoint">

<property name="realmName">

<value>Spring Web Realm</value>

</property>

</bean>



<!-- Define filter to handle FORM authentication -->

<bean id="formAuthenticationProcessingFilter"

class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter">

<property name="filterProcessesUrl">

<value>/j_acegi_security_check</value>

</property>

<property name="authenticationFailureUrl">

<value>/loginFailed.html</value>

</property>

<property name="defaultTargetUrl">

<value>/</value>

</property>

<property name="authenticationManager">

<ref bean="authenticationManager" />

</property>

</bean>



<!-- Define realm for FORM login-->

<bean id="formLoginAuthenticationEntryPoint"

class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">

<property name="loginFormUrl">

<value>/login.jsp</value>

</property>

<property name="forceHttps">

<value>false</value>

</property>

</bean>



<bean id="httpSessionContextIntegrationFilter"

class="org.acegisecurity.context.HttpSessionContextIntegrationFilter">

</bean>

<!-- End Security filter config -->



<!-- Start Security interceptor config -->

<!-- Define authentication manager, decision manager and secure URL patterns -->

<bean id="filterSecurityInterceptor"

class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">

<property name="authenticationManager">

<ref bean="authenticationManager" />

</property>

<property name="accessDecisionManager">

<ref bean="accessDecisionManager" />

</property>

<property name="objectDefinitionSource">

<value>

CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON

PATTERN_TYPE_APACHE_ANT

/secure/admin/*=ROLE_ADMIN

/secure/app/*=ROLE_USER

</value>

</property>

</bean>

<!-- End Security interceptor config -->











分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

797

主题

1

听众

1万

积分

资深设计师

Rank: 7Rank: 7Rank: 7

纳金币
5568
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

沙发
发表于 2011-8-9 15:04:46 |只看该作者
回复

使用道具 举报

462

主题

1

听众

31万

积分

首席设计师

Rank: 8Rank: 8

纳金币
2
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

板凳
发表于 2012-1-29 23:21:05 |只看该作者
春节即将来到,我用祝福捻制成的绒线,烛光下为您织起一件红色的毛衣:前身是平安,后身是幸福,吉祥是厚厚的肩,如意戴在袖子里,领子蕴藏着体贴,口袋把快乐盛满,穿在身上让暖和包裹着您,让我的心陪伴您度过新年。
回复

使用道具 举报

   

671

主题

1

听众

3247

积分

中级设计师

Rank: 5Rank: 5

纳金币
324742
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

地板
发表于 2012-2-8 23:29:10 |只看该作者
爱咋咋地!
回复

使用道具 举报

1023

主题

3

听众

359

积分

设计实习生

Rank: 2

纳金币
335582
精华
0

最佳新人

5#
发表于 2012-2-13 23:23:42 |只看该作者
无聊时可以刷屏幕 灌水 也可以试试 帖子的标题究竟可以写多长
回复

使用道具 举报

tc    

5089

主题

1

听众

33万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

6#
发表于 2012-3-24 23:30:39 |只看该作者
既来之,则看之!
回复

使用道具 举报

462

主题

1

听众

31万

积分

首席设计师

Rank: 8Rank: 8

纳金币
2
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

7#
发表于 2012-4-27 23:27:03 |只看该作者
不错 非常经典  实用
回复

使用道具 举报

5969

主题

1

听众

39万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

8#
发表于 2012-5-9 23:25:46 |只看该作者
你们都躲开,我来顶
回复

使用道具 举报

1023

主题

3

听众

359

积分

设计实习生

Rank: 2

纳金币
335582
精华
0

最佳新人

9#
发表于 2012-5-24 23:18:26 |只看该作者
提醒猪猪,千万不能让你看见
回复

使用道具 举报

   

671

主题

1

听众

3247

积分

中级设计师

Rank: 5Rank: 5

纳金币
324742
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

10#
发表于 2012-9-3 01:18:38 |只看该作者
先顶上去,偶要高亮加精鸟!
回复

使用道具 举报

12 第1页 | 共2 页下一页
返回列表 发新帖
您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2025-7-30 09:57 , Processed in 0.066684 second(s), 29 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部