Shiro Annotations

1、shiro 支持的注解
@RequiresAuthentication
@RequiresPermissions
@RequiresRoles
@RequiresUser
@RequiresGuest

在方法上加上上述的 shiro annotations,用 AOP 的知识可以理解成:定义了 Pointcut

2、Enabling Shiro Annotations

Requires Shiro’s Spring AOP integration to scan for the appropriate annotated classes.

<!-- Enable Shiro Annotations for Spring-configured beans.  Only run after -->
<!-- the lifecycleBeanProcessor has run: -->
<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor"/>

<bean class="org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
    <property name="securityManager" ref="securityManager"/>
</bean>

猜你喜欢

转载自blog.csdn.net/wwq518/article/details/80294862