Studying Acegi

Acegi主要的功能包括认证(Authentication)和授权(Authorization)。认证顾名思义就是确定该用户是否有权限登陆系统。而授权则是根据用户的信息得到该用户在本系统中可以进行的操作。
Acegi has provided about 14 authentication rules. Form Based Authentication and DAO Authentication has been widly used in development. In the framework of acegi, you can config the rules used in the system vsi ProviderManager(org.acegisecurity.providers.ProviderManager).For example:

xml 代码
  1. <bean id="authenticationManager"  
  2.         class="org.acegisecurity.providers.ProviderManager">  
  3.         <property name="providers">  
  4.             <list>  
  5.                 <ref local="daoAuthenticationProvider" />  
  6.             list>   There are some problems in these editor system so i just paste the coder.
  7.         property>  
  8.     bean>  
  9.     <bean id="daoAuthenticationProvider"  
  10.         class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">  
  11.         <property name="userDetailsService" ref="inMemoryDaoImpl" />  
  12.     bean>  
  13.     <bean id="inMemoryDaoImpl"  
  14.         class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">  
  15.         <property name="userMap">  
  16.             <value>  
  17.                 wangwei=123,ROLE_SUPERVISOR    
  18.                 user1user1=user1,ROLE_USER   
  19.             value>  
  20.         property>  
  21.     bean>  

In xml you should define like this:

xml 代码
  1. <filter>  
  2.   <filter-name>AcegiFilterChain</filter-name>  
  3.   <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>  
  4.   <init-param>  
  5.     <param-name>targetClass</param-name>  
  6.     <param-value>org.acegisecurity.util.FilterChainProxy</param-value>  
  7.   </init-param>  
  8. </filter>  
  9. <filter-mapping>  
  10.   <filter-name>AcegiFilterChain</filter-name>  
  11.   <url-pattern>/*</url-pattern>  
  12. </filter-mapping>  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值