12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:context="http://www.springframework.org/schema/context"
- 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-4.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-4.0.xsd">
- <bean id="jdbcRealm" class="org.apache.shiro.realm.jdbc.JdbcRealm">
- <property name="dataSource" ref="dataSource" />
- <property name="authenticationQuery" value="select userpwd from t_user where userid = ?" />
- <property name="userRolesQuery"
- value="SELECT ROLEID FROM t_user_role inner join t_user on t_user.keyid=t_user_role.userid WHERE t_user.USERID=?" />
- <property name="permissionsQuery"
- value="SELECT PERMID FROM t_role_perm WHERE ROLEID=?" />
- <property name="permissionsLookupEnabled" value="true" />
- </bean>
- <!-- 缓存管理器使用Ehcache实现 -->
- <bean id="cacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
- <property name="cacheManagerConfigFile" value="classpath:ehcache.xml" />
- </bean>
- <bean id="myRealm" class="com.fsm.core.UserRealm"/>
- <!-- 安全管理器 -->
- <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
- <property name="realm" ref="myRealm" />
- </bean>
- <!-- Shiro 的Web过滤器 -->
- <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
- <property name="securityManager" ref="securityManager" />
- <property name="loginUrl" value="/myconsole/login" />
- <property name="unauthorizedUrl" value="/myconsole/unauthorized" />
- <property name="filterChainDefinitions">
- <value>
- /** = anon
- </value>
- </property>
- </bean>
- </beans>
|