mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-06-28 13:34:18 +08:00
fix: 修复单元测试中不通过的代码
This commit is contained in:
parent
5b5c031bdd
commit
eaef278426
@ -23,10 +23,11 @@ import cn.dev33.satoken.exception.SaTokenException;
|
|||||||
import cn.dev33.satoken.jwt.error.SaJwtErrorCode;
|
import cn.dev33.satoken.jwt.error.SaJwtErrorCode;
|
||||||
import cn.dev33.satoken.jwt.exception.SaJwtException;
|
import cn.dev33.satoken.jwt.exception.SaJwtException;
|
||||||
import cn.dev33.satoken.session.SaSession;
|
import cn.dev33.satoken.session.SaSession;
|
||||||
import cn.dev33.satoken.stp.parameter.SaLoginParameter;
|
|
||||||
import cn.dev33.satoken.stp.SaTokenInfo;
|
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||||
import cn.dev33.satoken.stp.StpLogic;
|
import cn.dev33.satoken.stp.StpLogic;
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import cn.dev33.satoken.stp.parameter.SaLoginParameter;
|
||||||
|
import cn.dev33.satoken.stp.parameter.SaLogoutParameter;
|
||||||
import cn.dev33.satoken.util.SaFoxUtil;
|
import cn.dev33.satoken.util.SaFoxUtil;
|
||||||
import cn.dev33.satoken.util.SaTokenConsts;
|
import cn.dev33.satoken.util.SaTokenConsts;
|
||||||
|
|
||||||
@ -136,34 +137,20 @@ public class StpLogicJwtForMixin extends StpLogic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [禁用] 会话注销,根据账号id 和 设备类型
|
* [work] 注销下线
|
||||||
|
*
|
||||||
|
* @param tokenValue 指定 token
|
||||||
|
* @param logoutParameter 注销参数
|
||||||
*/
|
*/
|
||||||
@Override
|
public void _logoutByTokenValue(String tokenValue, SaLogoutParameter logoutParameter) {
|
||||||
public void logout(Object loginId, String deviceType) {
|
|
||||||
throw new ApiDisabledException();
|
throw new ApiDisabledException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [禁用] 会话注销,根据指定 Token
|
* [禁用] 会话注销
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void logoutByTokenValue(String tokenValue) {
|
public void _logout(Object loginId, SaLogoutParameter logoutParameter) {
|
||||||
throw new ApiDisabledException();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [禁用] 踢人下线,根据账号id 和 设备类型
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void kickout(Object loginId, String deviceType) {
|
|
||||||
throw new ApiDisabledException();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [禁用] 踢人下线,根据指定 Token
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void kickoutByTokenValue(String tokenValue) {
|
|
||||||
throw new ApiDisabledException();
|
throw new ApiDisabledException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,9 +26,9 @@ import cn.dev33.satoken.session.SaSession;
|
|||||||
import cn.dev33.satoken.spring.SpringMVCUtil;
|
import cn.dev33.satoken.spring.SpringMVCUtil;
|
||||||
import cn.dev33.satoken.spring.pathmatch.SaPathMatcherHolder;
|
import cn.dev33.satoken.spring.pathmatch.SaPathMatcherHolder;
|
||||||
import cn.dev33.satoken.stp.SaLoginConfig;
|
import cn.dev33.satoken.stp.SaLoginConfig;
|
||||||
import cn.dev33.satoken.stp.parameter.SaLoginParameter;
|
|
||||||
import cn.dev33.satoken.stp.StpLogic;
|
import cn.dev33.satoken.stp.StpLogic;
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import cn.dev33.satoken.stp.parameter.SaLoginParameter;
|
||||||
import cn.dev33.satoken.util.SaTokenConsts;
|
import cn.dev33.satoken.util.SaTokenConsts;
|
||||||
import cn.dev33.satoken.util.SoMap;
|
import cn.dev33.satoken.util.SoMap;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
@ -253,6 +253,7 @@ public class BasicsTest {
|
|||||||
// 测试:根据token强制注销
|
// 测试:根据token强制注销
|
||||||
@Test
|
@Test
|
||||||
public void testLogoutByToken() {
|
public void testLogoutByToken() {
|
||||||
|
StpUtil.logout(10001);
|
||||||
|
|
||||||
// 先登录上
|
// 先登录上
|
||||||
StpUtil.login(10001);
|
StpUtil.login(10001);
|
||||||
|
@ -57,7 +57,7 @@ public class ManyLoginTest {
|
|||||||
// 测试:并发登录、共享token、同端
|
// 测试:并发登录、共享token、同端
|
||||||
@Test
|
@Test
|
||||||
public void login() {
|
public void login() {
|
||||||
SaManager.setConfig(new SaTokenConfig());
|
SaManager.setConfig(new SaTokenConfig().setIsShare(true));
|
||||||
|
|
||||||
StpUtil.login(10001);
|
StpUtil.login(10001);
|
||||||
String token1 = StpUtil.getTokenValue();
|
String token1 = StpUtil.getTokenValue();
|
||||||
|
Loading…
Reference in New Issue
Block a user