|
|
@@ -1,7 +1,9 @@
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
|
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
|
|
|
- xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util"
|
|
|
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
|
+ xmlns:aop="http://www.springframework.org/schema/aop"
|
|
|
+ xmlns:tx="http://www.springframework.org/schema/tx"
|
|
|
+ xmlns:util="http://www.springframework.org/schema/util"
|
|
|
xmlns:context="http://www.springframework.org/schema/context"
|
|
|
xsi:schemaLocation="
|
|
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
|
|
@@ -10,11 +12,26 @@
|
|
|
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
|
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
|
|
|
|
|
|
- <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
|
|
|
+ <bean id="jedisPoolConfig"
|
|
|
+ class="redis.clients.jedis.JedisPoolConfig">
|
|
|
<property name="maxIdle" value="100" />
|
|
|
<property name="minIdle" value="10" />
|
|
|
<property name="testOnBorrow" value="true" />
|
|
|
</bean>
|
|
|
+ <bean id="poolConfig" class="org.apache.commons.pool2.impl.GenericObjectPoolConfig">
|
|
|
+ <property name="minIdle" value="5"/>
|
|
|
+ <property name="maxIdle" value="20"/>
|
|
|
+ <property name="maxWaitMillis" value="100000"/>
|
|
|
+ <property name="maxTotal" value="10000"/>
|
|
|
+ </bean>
|
|
|
+
|
|
|
+ <bean id="jedisPool" class="redis.clients.jedis.JedisPool">
|
|
|
+ <constructor-arg name="poolConfig" ref="poolConfig"/>
|
|
|
+ <constructor-arg name="host" value="${jedis.host}"/>
|
|
|
+ <constructor-arg name="port" value="${jedis.port}"/>
|
|
|
+ <constructor-arg name="password" value="${jedis.password}"/>
|
|
|
+ <constructor-arg name="timeout" value="1000000"/>
|
|
|
+ </bean>
|
|
|
|
|
|
<bean id="redisConnectionFactory"
|
|
|
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
|
|
|
@@ -26,37 +43,45 @@
|
|
|
<!-- <property name="database" value="${jedis.dbIndex}" /> -->
|
|
|
</bean>
|
|
|
|
|
|
- <bean id="redisTemplate" class="com.goafanti.core.cache.template.FastJsonRedisTemplate">
|
|
|
- <constructor-arg index="0" ref="redisConnectionFactory" />
|
|
|
+ <bean id="redisTemplate"
|
|
|
+ class="com.goafanti.core.cache.template.FastJsonRedisTemplate">
|
|
|
+ <constructor-arg index="0"
|
|
|
+ ref="redisConnectionFactory" />
|
|
|
</bean>
|
|
|
- <bean id="sessionRedisTemplate" class="com.goafanti.core.shiro.cache.template.SessionRedisTemplate">
|
|
|
- <constructor-arg index="0" ref="redisConnectionFactory" />
|
|
|
+ <bean id="sessionRedisTemplate"
|
|
|
+ class="com.goafanti.core.shiro.cache.template.SessionRedisTemplate">
|
|
|
+ <constructor-arg index="0"
|
|
|
+ ref="redisConnectionFactory" />
|
|
|
</bean>
|
|
|
-
|
|
|
- <bean id="cacheManager" class="org.springframework.data.redis.cache.RedisCacheManager">
|
|
|
+
|
|
|
+ <bean id="cacheManager"
|
|
|
+ class="org.springframework.data.redis.cache.RedisCacheManager">
|
|
|
<constructor-arg index="0" ref="redisTemplate" />
|
|
|
- <property name="defaultExpiration" value="86400" />
|
|
|
+ <property name="defaultExpiration" value="86400" />
|
|
|
</bean>
|
|
|
-
|
|
|
- <bean id="shrioRedisCacheManager" class="com.goafanti.core.shiro.cache.ShiroRedisCacheManager">
|
|
|
+
|
|
|
+ <bean id="shrioRedisCacheManager"
|
|
|
+ class="com.goafanti.core.shiro.cache.ShiroRedisCacheManager">
|
|
|
<property name="redisTemplate" ref="sessionRedisTemplate" />
|
|
|
<property name="expire" value="2592000" />
|
|
|
</bean>
|
|
|
-
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
<bean id="sessionIdGenerator"
|
|
|
class="org.apache.shiro.session.mgt.eis.JavaUuidSessionIdGenerator" />
|
|
|
|
|
|
- <bean id="sessionIdCookie" class="org.apache.shiro.web.servlet.SimpleCookie">
|
|
|
+ <bean id="sessionIdCookie"
|
|
|
+ class="org.apache.shiro.web.servlet.SimpleCookie">
|
|
|
<constructor-arg value="AFT_SID" />
|
|
|
<property name="httpOnly" value="true" />
|
|
|
<property name="maxAge" value="2592000" />
|
|
|
<!-- <property name="domain" value=""/> -->
|
|
|
</bean>
|
|
|
|
|
|
- <bean id="customSessionListener" class="com.goafanti.core.shiro.listener.CustomSessionListener">
|
|
|
+ <bean id="customSessionListener"
|
|
|
+ class="com.goafanti.core.shiro.listener.CustomSessionListener">
|
|
|
<property name="redisTemplate" ref="sessionRedisTemplate" />
|
|
|
</bean>
|
|
|
|
|
|
@@ -69,11 +94,13 @@
|
|
|
<bean id="sessionValidationScheduler"
|
|
|
class="org.apache.shiro.session.mgt.ExecutorServiceSessionValidationScheduler">
|
|
|
<!-- -->
|
|
|
- <property name="interval" value="${session.validate.timespan}" />
|
|
|
+ <property name="interval"
|
|
|
+ value="${session.validate.timespan}" />
|
|
|
<property name="sessionManager" ref="sessionManager" />
|
|
|
</bean>
|
|
|
<!-- -->
|
|
|
- <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
|
|
|
+ <bean id="securityManager"
|
|
|
+ class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
|
|
|
<property name="realm" ref="userRealm" />
|
|
|
<property name="sessionManager" ref="sessionManager" />
|
|
|
<property name="cacheManager" ref="shrioRedisCacheManager" />
|
|
|
@@ -87,17 +114,21 @@
|
|
|
<!-- credential matcher -->
|
|
|
<bean id="credentialsMatcher"
|
|
|
class="org.apache.shiro.authc.credential.HashedCredentialsMatcher">
|
|
|
- <property name="hashAlgorithmName" value="${pwd.hash_algorithm_name}" />
|
|
|
- <property name="hashIterations" value="${pwd.hash_iterations}" />
|
|
|
+ <property name="hashAlgorithmName"
|
|
|
+ value="${pwd.hash_algorithm_name}" />
|
|
|
+ <property name="hashIterations"
|
|
|
+ value="${pwd.hash_iterations}" />
|
|
|
<property name="storedCredentialsHexEncoded" value="true" />
|
|
|
</bean>
|
|
|
<!-- -->
|
|
|
- <bean id="userRealm" class="com.goafanti.core.shiro.token.UserRealm">
|
|
|
+ <bean id="userRealm"
|
|
|
+ class="com.goafanti.core.shiro.token.UserRealm">
|
|
|
<property name="credentialsMatcher" ref="credentialsMatcher" />
|
|
|
</bean>
|
|
|
|
|
|
<!-- Session Manager -->
|
|
|
- <bean id="sessionManager" class="com.goafanti.core.shiro.session.CustomSessionManager">
|
|
|
+ <bean id="sessionManager"
|
|
|
+ class="com.goafanti.core.shiro.session.CustomSessionManager">
|
|
|
<!-- class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager"> -->
|
|
|
<property name="sessionIdUrlRewritingEnabled" value="false" />
|
|
|
<!-- -->
|
|
|
@@ -113,35 +144,43 @@
|
|
|
</list>
|
|
|
</property>
|
|
|
<!-- -->
|
|
|
- <property name="sessionValidationScheduler" ref="sessionValidationScheduler" />
|
|
|
+ <property name="sessionValidationScheduler"
|
|
|
+ ref="sessionValidationScheduler" />
|
|
|
<!-- -->
|
|
|
- <property name="sessionValidationSchedulerEnabled" value="true" />
|
|
|
+ <property name="sessionValidationSchedulerEnabled"
|
|
|
+ value="true" />
|
|
|
<!-- -->
|
|
|
<property name="deleteInvalidSessions" value="true" />
|
|
|
<!-- -->
|
|
|
<property name="sessionIdCookie" ref="sessionIdCookie" />
|
|
|
</bean>
|
|
|
|
|
|
- <bean id="shiroManager" class="com.goafanti.core.shiro.service.impl.ShiroManagerImpl" />
|
|
|
+ <bean id="shiroManager"
|
|
|
+ class="com.goafanti.core.shiro.service.impl.ShiroManagerImpl" />
|
|
|
|
|
|
- <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
|
|
|
+ <bean id="shiroFilter"
|
|
|
+ class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
|
|
|
<property name="securityManager" ref="securityManager" />
|
|
|
<property name="loginUrl" value="/user/login" />
|
|
|
<property name="successUrl" value="/" />
|
|
|
<property name="unauthorizedUrl" value="/user/login" />
|
|
|
- <property name="filterChainDefinitions" value="#{shiroManager.loadFilterChainDefinitions()}" />
|
|
|
+ <property name="filterChainDefinitions"
|
|
|
+ value="#{shiroManager.loadFilterChainDefinitions()}" />
|
|
|
<property name="filters">
|
|
|
<util:map>
|
|
|
<entry key="login">
|
|
|
- <bean id="login" class="com.goafanti.core.shiro.filter.LoginFilter" />
|
|
|
+ <bean id="login"
|
|
|
+ class="com.goafanti.core.shiro.filter.LoginFilter" />
|
|
|
</entry>
|
|
|
<entry key="permission">
|
|
|
- <bean id="permission" class="com.goafanti.core.shiro.filter.PermissionFilter">
|
|
|
+ <bean id="permission"
|
|
|
+ class="com.goafanti.core.shiro.filter.PermissionFilter">
|
|
|
<property name="loginUrl" value="/admin/login" />
|
|
|
</bean>
|
|
|
</entry>
|
|
|
<entry key="admin">
|
|
|
- <bean id="admin" class="com.goafanti.core.shiro.filter.AdminFilter">
|
|
|
+ <bean id="admin"
|
|
|
+ class="com.goafanti.core.shiro.filter.AdminFilter">
|
|
|
<property name="loginUrl" value="/admin/login" />
|
|
|
</bean>
|
|
|
</entry>
|
|
|
@@ -149,5 +188,6 @@
|
|
|
</property>
|
|
|
</bean>
|
|
|
<!-- -->
|
|
|
- <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor" />
|
|
|
+ <bean id="lifecycleBeanPostProcessor"
|
|
|
+ class="org.apache.shiro.spring.LifecycleBeanPostProcessor" />
|
|
|
</beans>
|