Created
May 7, 2015 08:19
-
-
Save happy-tao/b1d33c32fe47107e6f9a to your computer and use it in GitHub Desktop.
shiro多角色OR关系通过
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd"> | |
<bean id="anyRolesAuthorizationFilter" class="com.iit.core.shiro.AnyRolesAuthorizationFilter" /> | |
<!-- 配置shiro的过滤器工厂类,id- shiroFilter要和我们在web.xml中配置的过滤器一致 --> | |
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"> | |
<!-- 调用我们配置的权限管理器 --> | |
<property name="securityManager" ref="securityManager" /> | |
<property name="filters"> | |
<map> | |
<entry key="anyRoles" value-ref="anyRolesAuthorizationFilter" /> | |
</map> | |
</property> | |
<!-- 配置我们的登录请求地址 --> | |
<property name="loginUrl" value="/account/login.html" /> | |
<!-- 配置我们在登录页登录成功后的跳转地址,如果你访问的是非/login地址,则跳到您访问的地址 --> | |
<property name="successUrl" value="/" /> | |
<!-- 如果您请求的资源不再您的权限范围,则跳转到/error请求地址 --> | |
<!-- <property name="unauthorizedUrl" value="/error.html" /> --> | |
<!-- 权限配置 --> | |
<property name="filterChainDefinitions"> | |
<value> | |
/user = anyRoles["shop","admin"] | |
</value> | |
</property> | |
</bean> | |
</beans> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment