高级搜索 网站地图 RSS订阅
热门搜索:  毕业论文范文  本科毕业论文范文  大学毕业论文  毕业论文  法律毕业论文  实习总结

实现基于Spring框架应用的权限控制系统

  【收藏】
来源:论文网 编辑整理:黎小红 发表时间:2007-11-24 16:57:28 【字体大小:

  授权管理器的配置方法与认证管理器的配置基本类似,这里不再讨论。
4、安全请求拦截器的配置

  以上配置完成后,就需要配置安全拦截器。不同的安全管理对象需要使用不同的安全拦截器。对于方法级的安全认证需要使用的拦截器为MethodSecurityInterceptor,而应用于URL资源的安全拦截器为FilterSecurityInterceptor 。其中,MethodSecurityInterceptor拦截器是借助于Spring Aop实现的,而FilterSecurityInterceptor拦截器是借助于Servlet Filter 实现的。本文以URL资源请求的安全拦截器为例说明配置情况。

  由于URL资源请求安全拦截是借助于过滤器进行的。因此首先要配置Acegi Servlet过滤器。过滤器类似于AOP Around装备,实现在web资源调用前后进行的一些操作6种过滤器,他们依次构成Servlet过滤器链,依次处理客户请求。需要注意的是过滤器配置的顺序是不能交换的,当不需要使用某个过滤器时,可直接将其删除和注释。过滤器在web.xml中配置形式为

<filter>

——内容来自www.17lw.com,一起论文网


 <filter-name>Acegi HTTP Request Security Filter</filter-name>
 <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
 <init-param>
  <param-name>targetClass</param-name>
  <param-value>
   Org.acegisecurity.intercept.web.SecurityEnforcementFilter
  </param-value>
 </init-param>
</filter>
<filter-mapping>
 <filter-name>Acigi HTTP Request Security Filter</filter-name>
 <url-pattern>/*</url-pattern>
</filter-mapping>

  在spring applicationContext.xml文件中的配置形式为

<bean id=”securityEnforcementFilter” class=””>
 <property name=”filterSecurityInterceptor”>
  <ref bean=”filterInvocationInteceptor”/> ——内容来自www.17lw.com,一起论文网
 </property>
 <property name=”authenticationEntryPoint”>
  <ref bean=”authenticationProcessingFilterEntryPoint”/>
 </property>

  以上代码是SecurityEnforcementFilter的配置,该过滤器对用户是否有权访问web资源作出最后的决定。其它的过滤器的配置类同。
配置完过滤器后,需要对拦截器FilterSecurityInterceptor进行配置,

<bean id=”filterInvocationInterceptor”
Class=””>
 <property name=”authenuserCacheticationManager”>1
 <property name=”accessDecisionManager”>
 <property name=”objectDefinitionSource”>
  <ref local="filterObjectDefinitionSource"/>
 </property>
<bean id="filterObjectDefinitionSource" ——论文大聚合www.17lw.com,一起论文网
class="org.xiaohongli.acegi.db.DBFilterObjectDefinitionSource">
 <constructor-arg><refbean="jdbcTemplate"/>
 </constructor-arg>
</bean>

共4页: 上一页 [1] [2] 3 [4] 下一页