acegi 拦截struts2的方法,急!!!分数不够可再加!!!!
使用SSH做一个项目,其中使用到了struts2,权限访问控制使用了acegi,通过acegi可以对URL进行很好的控制了,但是对struts2的方法的控制却不行,查了好多,也没找到什么好方法,请各位高人看看那里配置的不对。现在的情况是如果只有methodSecurityInterceptor这部分,那么运行不报错,但是也没有实现权限的控制,如果按下面的写法,结果总是报
org.acegisecurity.AuthenticationCredentialsNotFoundException: An Authentication object was not found in the SecurityContext错误,
我怀疑是<property name="beanNames"><list><value>budget</value></list>中的budget无法解析,但是,budget是在spring中配置了的bean,它对应的是
<bean id="budget" class="action.budget.BudgetAction">
<property name="budgetService" ><ref bean="budgetService" /></property>
</bean>,是在另外一个文件中定义的,我们其它部分的运行都是没问题的,实在不知道这里是怎么回事了,请大家帮帮忙,谢谢
<!-- 测试对方法的拦截 -->
<bean id="methodSecurityInterceptor"
class="org.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager">
<ref bean="authenticationManager" />
</property>
<property name="accessDecisionManager">
<ref bean="accessDecisionManager" />
</property>
<property name="objectDefinitionSource">
<value>
action.budget.BudgetAction.addbudget=ROLE_ADMIN,ROLE_BUDGET_ADMIN
</value>
</property>
</bean>
<bean id="autoProxyCreator"
class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<value>budget</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>methodSecurityInterceptor</value>
</list>
</property>
</bean>