【更新】升级satoken为1.31.0
This commit is contained in:
parent
6300e29cd3
commit
7094edbd2b
@ -15,7 +15,7 @@
|
|||||||
<description>登录鉴权插件api接口</description>
|
<description>登录鉴权插件api接口</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<sa.token.version>1.30.0</sa.token.version>
|
<sa.token.version>1.31.0</sa.token.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -708,8 +708,8 @@ public class StpClientUtil {
|
|||||||
* @param size 获取数量
|
* @param size 获取数量
|
||||||
* @return token集合
|
* @return token集合
|
||||||
*/
|
*/
|
||||||
public static List<String> searchTokenValue(String keyword, int start, int size) {
|
public static List<String> searchTokenValue(String keyword, int start, int size, boolean sortType) {
|
||||||
return stpLogic.searchTokenValue(keyword, start, size);
|
return stpLogic.searchTokenValue(keyword, start, size, sortType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -719,8 +719,8 @@ public class StpClientUtil {
|
|||||||
* @param size 获取数量
|
* @param size 获取数量
|
||||||
* @return sessionId集合
|
* @return sessionId集合
|
||||||
*/
|
*/
|
||||||
public static List<String> searchSessionId(String keyword, int start, int size) {
|
public static List<String> searchSessionId(String keyword, int start, int size, boolean sortType) {
|
||||||
return stpLogic.searchSessionId(keyword, start, size);
|
return stpLogic.searchSessionId(keyword, start, size, sortType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -730,8 +730,8 @@ public class StpClientUtil {
|
|||||||
* @param size 获取数量
|
* @param size 获取数量
|
||||||
* @return sessionId集合
|
* @return sessionId集合
|
||||||
*/
|
*/
|
||||||
public static List<String> searchTokenSessionId(String keyword, int start, int size) {
|
public static List<String> searchTokenSessionId(String keyword, int start, int size, boolean sortType) {
|
||||||
return stpLogic.searchTokenSessionId(keyword, start, size);
|
return stpLogic.searchTokenSessionId(keyword, start, size, sortType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<description>登录鉴权插件</description>
|
<description>登录鉴权插件</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<sa.token.version>1.30.0</sa.token.version>
|
<sa.token.version>1.31.0</sa.token.version>
|
||||||
<just.auth.version>1.16.5</just.auth.version>
|
<just.auth.version>1.16.5</just.auth.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
@ -46,11 +46,11 @@ public class AuthExceptionUtil {
|
|||||||
// 如果是权限异常 403
|
// 如果是权限异常 403
|
||||||
NotPermissionException notPermissionException = (NotPermissionException) e;
|
NotPermissionException notPermissionException = (NotPermissionException) e;
|
||||||
commonResult = CommonResult.get(HttpStatus.HTTP_FORBIDDEN, "无此权限:" + notPermissionException.getPermission(), null);
|
commonResult = CommonResult.get(HttpStatus.HTTP_FORBIDDEN, "无此权限:" + notPermissionException.getPermission(), null);
|
||||||
} else if (e instanceof DisableLoginException) {
|
} else if (e instanceof DisableServiceException) {
|
||||||
|
|
||||||
// 如果是被封禁异常 403
|
// 如果是被封禁异常 403
|
||||||
DisableLoginException disableLoginException = (DisableLoginException) e;
|
DisableServiceException disableServiceException = (DisableServiceException) e;
|
||||||
commonResult = CommonResult.get(HttpStatus.HTTP_FORBIDDEN, "账号被封禁:" + disableLoginException.getDisableTime() + "秒后解封", null);
|
commonResult = CommonResult.get(HttpStatus.HTTP_FORBIDDEN, "账号被封禁:" + disableServiceException.getDisableTime() + "秒后解封", null);
|
||||||
} else if (e instanceof SaTokenException) {
|
} else if (e instanceof SaTokenException) {
|
||||||
|
|
||||||
// 如果是SaToken异常 直接返回
|
// 如果是SaToken异常 直接返回
|
||||||
|
@ -88,13 +88,13 @@ public class AuthListener implements SaTokenListener {
|
|||||||
|
|
||||||
/** 每次被封禁时触发 */
|
/** 每次被封禁时触发 */
|
||||||
@Override
|
@Override
|
||||||
public void doDisable(String loginType, Object loginId, long disableTime) {
|
public void doDisable(String loginType, Object loginId, String service, int level, long disableTime) {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 每次被解封时触发 */
|
/** 每次被解封时触发 */
|
||||||
@Override
|
@Override
|
||||||
public void doUntieDisable(String loginType, Object loginId) {
|
public void doUntieDisable(String loginType, Object loginId, String service) {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,4 +109,10 @@ public class AuthListener implements SaTokenListener {
|
|||||||
public void doLogoutSession(String id) {
|
public void doLogoutSession(String id) {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 每次Token续期时触发 */
|
||||||
|
@Override
|
||||||
|
public void doRenewTimeout(String tokenValue, Object loginId, long timeout) {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class AuthSessionServiceImpl implements AuthSessionService {
|
|||||||
@Override
|
@Override
|
||||||
public AuthSessionAnalysisResult analysis() {
|
public AuthSessionAnalysisResult analysis() {
|
||||||
AuthSessionAnalysisResult authSessionAnalysisResult = new AuthSessionAnalysisResult();
|
AuthSessionAnalysisResult authSessionAnalysisResult = new AuthSessionAnalysisResult();
|
||||||
List<JSONObject> sessionListB = StpUtil.searchSessionId("", -1, -1).stream().map(sessionId -> {
|
List<JSONObject> sessionListB = StpUtil.searchSessionId("", -1, -1, true).stream().map(sessionId -> {
|
||||||
JSONObject jsonObject = JSONUtil.createObj();
|
JSONObject jsonObject = JSONUtil.createObj();
|
||||||
String userId = StrUtil.split(sessionId, StrUtil.COLON).get(3);
|
String userId = StrUtil.split(sessionId, StrUtil.COLON).get(3);
|
||||||
SaSession saSession = StpUtil.getSessionByLoginId(userId, false);
|
SaSession saSession = StpUtil.getSessionByLoginId(userId, false);
|
||||||
@ -74,7 +74,7 @@ public class AuthSessionServiceImpl implements AuthSessionService {
|
|||||||
return jsonObject;
|
return jsonObject;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
List<JSONObject> sessionListC = StpClientUtil.searchSessionId("", -1, -1).stream().map(sessionId -> {
|
List<JSONObject> sessionListC = StpClientUtil.searchSessionId("", -1, -1, true).stream().map(sessionId -> {
|
||||||
JSONObject jsonObject = JSONUtil.createObj();
|
JSONObject jsonObject = JSONUtil.createObj();
|
||||||
String userId = StrUtil.split(sessionId, StrUtil.COLON).get(3);
|
String userId = StrUtil.split(sessionId, StrUtil.COLON).get(3);
|
||||||
SaSession saSession = StpClientUtil.getSessionByLoginId(userId, false);
|
SaSession saSession = StpClientUtil.getSessionByLoginId(userId, false);
|
||||||
@ -107,7 +107,7 @@ public class AuthSessionServiceImpl implements AuthSessionService {
|
|||||||
public Page<AuthSessionPageResult> pageForB(AuthSessionPageParam authSessionPageParam) {
|
public Page<AuthSessionPageResult> pageForB(AuthSessionPageParam authSessionPageParam) {
|
||||||
Page<AuthSessionPageResult> defaultPage = CommonPageRequest.defaultPage();
|
Page<AuthSessionPageResult> defaultPage = CommonPageRequest.defaultPage();
|
||||||
long current = defaultPage.getCurrent();
|
long current = defaultPage.getCurrent();
|
||||||
int total = StpUtil.searchSessionId("", -1, Convert.toInt(defaultPage.getSize())).size();
|
int total = StpUtil.searchSessionId("", -1, Convert.toInt(defaultPage.getSize()), true).size();
|
||||||
if(ObjectUtil.isNotEmpty(total)) {
|
if(ObjectUtil.isNotEmpty(total)) {
|
||||||
defaultPage = new Page<>(current, defaultPage.getSize(), total);
|
defaultPage = new Page<>(current, defaultPage.getSize(), total);
|
||||||
String keyword = "";
|
String keyword = "";
|
||||||
@ -116,7 +116,7 @@ public class AuthSessionServiceImpl implements AuthSessionService {
|
|||||||
}
|
}
|
||||||
List<String> userIdList = StpUtil.searchSessionId(keyword,
|
List<String> userIdList = StpUtil.searchSessionId(keyword,
|
||||||
Convert.toInt((current - 1) * defaultPage.getSize()),
|
Convert.toInt((current - 1) * defaultPage.getSize()),
|
||||||
Convert.toInt(defaultPage.getSize())).stream().map(sessionId ->
|
Convert.toInt(defaultPage.getSize()), true).stream().map(sessionId ->
|
||||||
StrUtil.split(sessionId, StrUtil.COLON).get(3)).collect(Collectors.toList());
|
StrUtil.split(sessionId, StrUtil.COLON).get(3)).collect(Collectors.toList());
|
||||||
if (ObjectUtil.isNotEmpty(userIdList)) {
|
if (ObjectUtil.isNotEmpty(userIdList)) {
|
||||||
List<AuthSessionPageResult> authSessionPageResultList = loginUserApi.listUserByUserIdList(userIdList).stream().map(userJsonObject -> {
|
List<AuthSessionPageResult> authSessionPageResultList = loginUserApi.listUserByUserIdList(userIdList).stream().map(userJsonObject -> {
|
||||||
@ -164,7 +164,7 @@ public class AuthSessionServiceImpl implements AuthSessionService {
|
|||||||
public Page<AuthSessionPageResult> pageForC(AuthSessionPageParam authSessionPageParam) {
|
public Page<AuthSessionPageResult> pageForC(AuthSessionPageParam authSessionPageParam) {
|
||||||
Page<AuthSessionPageResult> defaultPage = CommonPageRequest.defaultPage();
|
Page<AuthSessionPageResult> defaultPage = CommonPageRequest.defaultPage();
|
||||||
long current = defaultPage.getCurrent();
|
long current = defaultPage.getCurrent();
|
||||||
int total = StpClientUtil.searchSessionId("", -1, Convert.toInt(defaultPage.getSize())).size();
|
int total = StpClientUtil.searchSessionId("", -1, Convert.toInt(defaultPage.getSize()), true).size();
|
||||||
if(ObjectUtil.isNotEmpty(total)) {
|
if(ObjectUtil.isNotEmpty(total)) {
|
||||||
defaultPage = new Page<>(current, defaultPage.getSize(), total);
|
defaultPage = new Page<>(current, defaultPage.getSize(), total);
|
||||||
String keyword = "";
|
String keyword = "";
|
||||||
@ -173,10 +173,10 @@ public class AuthSessionServiceImpl implements AuthSessionService {
|
|||||||
}
|
}
|
||||||
List<String> userIdList = StpClientUtil.searchSessionId(keyword,
|
List<String> userIdList = StpClientUtil.searchSessionId(keyword,
|
||||||
Convert.toInt((current - 1) * defaultPage.getSize()),
|
Convert.toInt((current - 1) * defaultPage.getSize()),
|
||||||
Convert.toInt(defaultPage.getSize())).stream().map(sessionId ->
|
Convert.toInt(defaultPage.getSize()), true).stream().map(sessionId ->
|
||||||
StrUtil.split(sessionId, StrUtil.COLON).get(3)).collect(Collectors.toList());
|
StrUtil.split(sessionId, StrUtil.COLON).get(3)).collect(Collectors.toList());
|
||||||
if (ObjectUtil.isNotEmpty(userIdList)) {
|
if (ObjectUtil.isNotEmpty(userIdList)) {
|
||||||
List<AuthSessionPageResult> authSessionPageResultList = loginUserApi.listUserByUserIdList(userIdList).stream().map(userJsonObject -> {
|
List<AuthSessionPageResult> authSessionPageResultList = clientLoginUserApi.listUserByUserIdList(userIdList).stream().map(userJsonObject -> {
|
||||||
SaSession saSession = StpClientUtil.getSessionByLoginId(userJsonObject.getStr("id"), false);
|
SaSession saSession = StpClientUtil.getSessionByLoginId(userJsonObject.getStr("id"), false);
|
||||||
AuthSessionPageResult authSessionPageResult = JSONUtil.toBean(userJsonObject, AuthSessionPageResult.class);
|
AuthSessionPageResult authSessionPageResult = JSONUtil.toBean(userJsonObject, AuthSessionPageResult.class);
|
||||||
authSessionPageResult.setSessionId(saSession.getId());
|
authSessionPageResult.setSessionId(saSession.getId());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user