fix: 退出登录接口
parent
a1c84249e5
commit
de53e07304
|
@ -46,7 +46,7 @@ public class SaTokenConfig implements WebMvcConfigurer {
|
|||
List<String> swaggerUrls = List.of("/doc.html","/favicon.ico", "/webjars/**", "/resources/**"
|
||||
, "/swagger-resources/**", "/swagger-ui.html/**");
|
||||
|
||||
List loginUrls = List.of("/code", "/auth/tenant/list", "/auth/login");
|
||||
List loginUrls = List.of("/code", "/auth/tenant/list", "/auth/login", "/auth/logout");
|
||||
List<String> openApiUrls = List.of( "/openapi/v1/getToken");
|
||||
|
||||
List<String> excludeUrls = new ArrayList<>();
|
||||
|
|
|
@ -4,10 +4,12 @@ import cc.iotkit.common.constant.TenantConstants;
|
|||
import cc.iotkit.common.constant.UserConstants;
|
||||
import cc.iotkit.common.enums.DeviceType;
|
||||
import cc.iotkit.common.enums.UserType;
|
||||
import cc.iotkit.common.exception.BizException;
|
||||
import cc.iotkit.common.undefined.LoginUser;
|
||||
import cn.dev33.satoken.context.SaHolder;
|
||||
import cn.dev33.satoken.context.model.SaStorage;
|
||||
import cn.dev33.satoken.exception.InvalidContextException;
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
@ -76,7 +78,11 @@ public class LoginHelper {
|
|||
if (loginUser != null) {
|
||||
return loginUser;
|
||||
}
|
||||
loginUser = (LoginUser) StpUtil.getTokenSession().get(LOGIN_USER_KEY);
|
||||
SaSession tokenSession = StpUtil.getTokenSession();
|
||||
if(tokenSession == null){
|
||||
return null;
|
||||
}
|
||||
loginUser = (LoginUser) tokenSession.get(LOGIN_USER_KEY);
|
||||
SaHolder.getStorage().set(LOGIN_USER_KEY, loginUser);
|
||||
return loginUser;
|
||||
}
|
||||
|
|
|
@ -174,6 +174,9 @@ public class SysLoginService {
|
|||
public void logout() {
|
||||
try {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
if(loginUser==null){
|
||||
return;
|
||||
}
|
||||
if (LoginHelper.isSuperAdmin()) {
|
||||
// 超级管理员 登出清除动态租户
|
||||
TenantHelper.clearDynamic();
|
||||
|
|
Loading…
Reference in New Issue