v1.27.1 beta. 细节优化

This commit is contained in:
click33
2021-10-19 20:43:13 +08:00
parent 82591e397f
commit f9ec6e6487
5 changed files with 19 additions and 7 deletions

View File

@@ -93,7 +93,7 @@ public class SaLoginModel {
/**
* @return 获取device参数如果为null则返回默认值
*/
public String getDeviceOrDefalut() {
public String getDeviceOrDefault() {
if(device == null) {
return SaTokenConsts.DEFAULT_LOGIN_DEVICE;
}
@@ -142,4 +142,13 @@ public class SaLoginModel {
return "SaLoginModel [device=" + device + ", isLastingCookie=" + isLastingCookie + ", timeout=" + timeout + "]";
}
/**
* 更换为 getDeviceOrDefault()
* @return /
*/
@Deprecated
public String getDeviceOrDefalut() {
return getDeviceOrDefault();
}
}

View File

@@ -256,7 +256,7 @@ public class StpLogic {
if(config.getIsConcurrent()) {
// 如果配置为共享token, 则尝试从Session签名记录里取出token
if(config.getIsShare()) {
tokenValue = getTokenValueByLoginId(id, loginModel.getDevice());
tokenValue = getTokenValueByLoginId(id, loginModel.getDeviceOrDefault());
}
} else {
// --- 如果不允许并发登录,则将这个账号的历史登录标记为:被顶下线
@@ -272,7 +272,7 @@ public class StpLogic {
session.updateMinTimeout(loginModel.getTimeout());
// 在 User-Session 上记录token签名
session.addTokenSign(tokenValue, loginModel.getDeviceOrDefalut());
session.addTokenSign(tokenValue, loginModel.getDeviceOrDefault());
// ------ 4. 持久化其它数据
// token -> id 映射关系