shiro和Spring整合使用注解时没有执行realm的doGetAuthorizationInfo回调方法的解决
?
shiro和Spring整合使用注解時沒有執行realm的doGetAuthorizationInfo回調方法的解決
from :http://blog.csdn.net/babys/article/details/50151407
在使用Shiro框架進行項目整合時,使用注解在使用Shiro框架進行項目整合時,使用注解在使用Shiro框架進行項目整合時,使用注解@RequiresPermissions為方法提供是需要的權限,但是根本沒有進行驗證,后面發現在自己的Realm中只執行了doGetAuthenticationInfo(登錄驗證)方法而沒有執行doGetAuthorizationInfo(權限驗證)的方法。
查看相關資料后發現是因為在Springmvc的配置文件中(我的名字是spring-servlet.xml)沒有加入
<aop:config proxy-target-class="true"/>
加入后解決問題.
貌似也可以使用:
<!-- 支持Shiro對Controller的方法級AOP安全控制 begin-->
<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor">
<property name="proxyTargetClass" value="true" />
</bean>
<!-- 保證實現了Shiro內部lifecycle函數的bean執行 -->
<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
但是一定要記住是把這些配置放在 ? ? SpringMvc的配置文件中。
總結
以上是生活随笔為你收集整理的shiro和Spring整合使用注解时没有执行realm的doGetAuthorizationInfo回调方法的解决的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 影视编导考前哪里教的比较好?
- 下一篇: 一千零一夜书作者是谁啊?