mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-09-18 03:16:40 +08:00
v3.11.0 【优化】SaTokenConfig与三级等保配置关联;【优化】smart-app去掉无用请求;
This commit is contained in:
parent
b3b20bc029
commit
cb39dedfd5
@ -0,0 +1,34 @@
|
|||||||
|
package net.lab1024.sa.base.config;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.config.SaTokenConfig;
|
||||||
|
import net.lab1024.sa.base.module.support.securityprotect.service.Level3ProtectConfigService;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 三级等保配置初始化后最低活跃频率全局配置
|
||||||
|
*
|
||||||
|
* @Author 1024创新实验室-创始人兼主任:卓大
|
||||||
|
* @Date 2024/11/24
|
||||||
|
* @Wechat zhuoda1024
|
||||||
|
* @Email lab1024@163.com
|
||||||
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a> ,Since 2012
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class TokenConfig {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private Level3ProtectConfigService level3ProtectConfigService;
|
||||||
|
|
||||||
|
// 此配置会覆盖 sa-base.yaml 中的配置
|
||||||
|
@Resource
|
||||||
|
public void configSaToken(SaTokenConfig config) {
|
||||||
|
|
||||||
|
config.setActiveTimeout(level3ProtectConfigService.getLoginActiveTimeoutSeconds());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -44,7 +44,7 @@ public class Level3ProtectConfigService {
|
|||||||
/**
|
/**
|
||||||
* 最低活跃时间(单位:秒),超过此时间没有操作系统就会被冻结,默认-1 代表不限制,永不冻结; 默认 30分钟
|
* 最低活跃时间(单位:秒),超过此时间没有操作系统就会被冻结,默认-1 代表不限制,永不冻结; 默认 30分钟
|
||||||
*/
|
*/
|
||||||
private int loginActiveTimeoutSeconds = 1800;
|
private int loginActiveTimeoutSeconds = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密码复杂度 是否开启,默认:开启
|
* 密码复杂度 是否开启,默认:开启
|
||||||
|
@ -40,7 +40,7 @@ spring:
|
|||||||
host: smtp.163.com
|
host: smtp.163.com
|
||||||
port: 465
|
port: 465
|
||||||
username: lab1024@163.com
|
username: lab1024@163.com
|
||||||
password: ROIMSIQCEXHTQFTA
|
password: LAB1024LAB
|
||||||
properties:
|
properties:
|
||||||
mail:
|
mail:
|
||||||
smtp:
|
smtp:
|
||||||
|
@ -21,6 +21,7 @@ spring:
|
|||||||
pointcut: net.lab1024.sa..*Service.*
|
pointcut: net.lab1024.sa..*Service.*
|
||||||
|
|
||||||
# redis 连接池配置信息
|
# redis 连接池配置信息
|
||||||
|
data:
|
||||||
redis:
|
redis:
|
||||||
database: 1
|
database: 1
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package net.lab1024.sa.base.config;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.config.SaTokenConfig;
|
||||||
|
import net.lab1024.sa.base.module.support.securityprotect.service.Level3ProtectConfigService;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 三级等保配置初始化后最低活跃频率全局配置
|
||||||
|
*
|
||||||
|
* @Author 1024创新实验室-创始人兼主任:卓大
|
||||||
|
* @Date 2024/11/24
|
||||||
|
* @Wechat zhuoda1024
|
||||||
|
* @Email lab1024@163.com
|
||||||
|
* @Copyright <a href="https://1024lab.net">1024创新实验室</a> ,Since 2012
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class TokenConfig {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private Level3ProtectConfigService level3ProtectConfigService;
|
||||||
|
|
||||||
|
// 此配置会覆盖 sa-base.yaml 中的配置
|
||||||
|
@Resource
|
||||||
|
public void configSaToken(SaTokenConfig config) {
|
||||||
|
|
||||||
|
config.setActiveTimeout(level3ProtectConfigService.getLoginActiveTimeoutSeconds());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -45,7 +45,7 @@ public class Level3ProtectConfigService {
|
|||||||
/**
|
/**
|
||||||
* 最低活跃时间(单位:秒),超过此时间没有操作系统就会被冻结,默认-1 代表不限制,永不冻结; 默认 30分钟
|
* 最低活跃时间(单位:秒),超过此时间没有操作系统就会被冻结,默认-1 代表不限制,永不冻结; 默认 30分钟
|
||||||
*/
|
*/
|
||||||
private int loginActiveTimeoutSeconds = 1800;
|
private int loginActiveTimeoutSeconds = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密码复杂度 是否开启,默认:开启
|
* 密码复杂度 是否开启,默认:开启
|
||||||
|
@ -61,13 +61,19 @@ export const useUserStore = defineStore({
|
|||||||
logout() {
|
logout() {
|
||||||
this.token = null;
|
this.token = null;
|
||||||
this.setUserLoginInfo(defaultUserInfo);
|
this.setUserLoginInfo(defaultUserInfo);
|
||||||
|
console.log(333,USER_TOKEN);
|
||||||
uni.removeStorage(USER_TOKEN);
|
uni.removeStorage(USER_TOKEN);
|
||||||
},
|
},
|
||||||
clearUserLoginInfo() {
|
clearUserLoginInfo() {
|
||||||
this.setUserLoginInfo(defaultUserInfo);
|
this.setUserLoginInfo(defaultUserInfo);
|
||||||
|
console.log(444,USER_TOKEN);
|
||||||
uni.removeStorage(USER_TOKEN);
|
uni.removeStorage(USER_TOKEN);
|
||||||
},
|
},
|
||||||
async getLoginInfo() {
|
async getLoginInfo() {
|
||||||
|
let token = uni.getStorageSync(USER_TOKEN);
|
||||||
|
if(!token){
|
||||||
|
return;
|
||||||
|
}
|
||||||
let res = await loginApi.getLoginInfo();
|
let res = await loginApi.getLoginInfo();
|
||||||
this.setUserLoginInfo(res.data);
|
this.setUserLoginInfo(res.data);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user