支持配置管理页面登录超时时间
parent
696d182f6a
commit
b37b9f3b03
|
@ -170,4 +170,9 @@ public class UserSetting {
|
|||
*/
|
||||
private int gbDeviceOnline = 1;
|
||||
|
||||
/**
|
||||
* 登录超时时间(分钟),
|
||||
*/
|
||||
private long loginTimeout = 30;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.genersoft.iot.vmp.conf.security;
|
||||
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.security.dto.JwtUser;
|
||||
import com.genersoft.iot.vmp.service.IUserApiKeyService;
|
||||
import com.genersoft.iot.vmp.service.IUserService;
|
||||
|
@ -54,6 +55,8 @@ public class JwtUtils implements InitializingBean {
|
|||
|
||||
private static IUserApiKeyService userApiKeyService;
|
||||
|
||||
private static UserSetting userSetting;
|
||||
|
||||
public static String getApiKeyHeader() {
|
||||
return API_KEY_HEADER;
|
||||
}
|
||||
|
@ -68,6 +71,11 @@ public class JwtUtils implements InitializingBean {
|
|||
JwtUtils.userApiKeyService = userApiKeyService;
|
||||
}
|
||||
|
||||
@Resource
|
||||
public void setUserSetting(UserSetting userSetting) {
|
||||
JwtUtils.userSetting = userSetting;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
try {
|
||||
|
@ -153,7 +161,7 @@ public class JwtUtils implements InitializingBean {
|
|||
}
|
||||
|
||||
public static String createToken(String username) {
|
||||
return createToken(username, EXPIRATION_TIME);
|
||||
return createToken(username, userSetting.getLoginTimeout());
|
||||
}
|
||||
|
||||
public static String getHeader() {
|
||||
|
|
|
@ -251,6 +251,8 @@ user-settings:
|
|||
# 0: 国标标准实现,设备离线后不回复心跳,直到设备重新注册上线,
|
||||
# 1(默认): 对于离线设备,收到心跳就把设备设置为上线,并更新注册时间为上次这次心跳的时间。防止过期时间判断异常
|
||||
gb-device-online: 0
|
||||
# 登录超时时间(分钟),
|
||||
login-timeout: 30
|
||||
|
||||
# 关闭在线文档(生产环境建议关闭)
|
||||
springdoc:
|
||||
|
|
Loading…
Reference in New Issue