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