forked from github/dataease
fix: 登录超时时间可配置
This commit is contained in:
parent
65d1808488
commit
1ed42b1fa5
@ -13,6 +13,8 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@ -22,7 +24,9 @@ public class JWTUtils {
|
||||
// token过期时间1min (过期会自动刷新续命 目的是避免一直都是同一个token )
|
||||
private static final long EXPIRE_TIME = 1*60*1000;
|
||||
// 登录间隔时间10min 超过这个时间强制重新登录
|
||||
private static final long Login_Interval = 10*60*1000;
|
||||
private static long Login_Interval;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -79,6 +83,11 @@ public class JWTUtils {
|
||||
* @return
|
||||
*/
|
||||
public static boolean loginExpire(String token){
|
||||
if (Login_Interval==0) {
|
||||
String property = CommonBeanFactory.getBean(Environment.class).getProperty("dataease.login_timeout");
|
||||
int seconds = StringUtils.isNotEmpty(property) ? Integer.parseInt(property): (10*60);
|
||||
Login_Interval = seconds * 1000;
|
||||
}
|
||||
Long now = System.currentTimeMillis();
|
||||
Long lastOperateTime = tokenLastOperateTime(token);
|
||||
boolean isExpire = false;
|
||||
@ -169,4 +178,5 @@ public class JWTUtils {
|
||||
long now = System.currentTimeMillis();
|
||||
tokens_expire.put(token, now);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -62,6 +62,10 @@ spring.mvc.log-request-details=true
|
||||
pagehelper.PageRowBounds=true
|
||||
#excel等用户上传文件路径
|
||||
upload.file.path=/opt/dataease/data/upload/
|
||||
#用户初始密码,如果不设置默认是DataEase123..
|
||||
dataease.init_password=DataEase123456
|
||||
#登录超时时间单位s 设置默认30分钟 如果雨不设置 默认10分钟也就是10*60
|
||||
dataease.login_timeout=1800
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user