|
@@ -2,6 +2,8 @@ package com.xingxi.framework.shiro.service;
|
|
|
|
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import javax.annotation.PostConstruct;
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
+
|
|
|
|
|
+import com.xingxi.common.core.redis.RedisCache;
|
|
|
import org.apache.shiro.cache.Cache;
|
|
import org.apache.shiro.cache.Cache;
|
|
|
import org.apache.shiro.cache.CacheManager;
|
|
import org.apache.shiro.cache.CacheManager;
|
|
|
import org.apache.shiro.crypto.hash.Md5Hash;
|
|
import org.apache.shiro.crypto.hash.Md5Hash;
|
|
@@ -25,8 +27,10 @@ import com.xingxi.framework.manager.factory.AsyncFactory;
|
|
|
@Component
|
|
@Component
|
|
|
public class SysPasswordService
|
|
public class SysPasswordService
|
|
|
{
|
|
{
|
|
|
|
|
+// @Autowired
|
|
|
|
|
+// private CacheManager cacheManager;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private CacheManager cacheManager;
|
|
|
|
|
|
|
+ private RedisCache redisCache;
|
|
|
|
|
|
|
|
private Cache<String, AtomicInteger> loginRecordCache;
|
|
private Cache<String, AtomicInteger> loginRecordCache;
|
|
|
|
|
|
|
@@ -36,7 +40,9 @@ public class SysPasswordService
|
|
|
@PostConstruct
|
|
@PostConstruct
|
|
|
public void init()
|
|
public void init()
|
|
|
{
|
|
{
|
|
|
- loginRecordCache = cacheManager.getCache(ShiroConstants.LOGIN_RECORD_CACHE);
|
|
|
|
|
|
|
+// loginRecordCache = cacheManager.getCache(ShiroConstants.LOGIN_RECORD_CACHE);
|
|
|
|
|
+ loginRecordCache = redisCache.getCacheObject(ShiroConstants.LOGIN_RECORD_CACHE);
|
|
|
|
|
+ redisCache.expire(ShiroConstants.LOGIN_RECORD_CACHE, 60 * 5);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void validate(SysUser user, String password)
|
|
public void validate(SysUser user, String password)
|