Revert "refactor(gateway): 重写is-login方法,不用响应式,防止阻塞redisson线程"
This reverts commit 45c733c30e
.
This commit is contained in:
parent
d742e0d84f
commit
5871a9eac5
|
@ -5,7 +5,6 @@ import io.metersphere.commons.constants.OperLogConstants;
|
||||||
import io.metersphere.commons.constants.OperLogModule;
|
import io.metersphere.commons.constants.OperLogModule;
|
||||||
import io.metersphere.commons.constants.SessionConstants;
|
import io.metersphere.commons.constants.SessionConstants;
|
||||||
import io.metersphere.commons.user.SessionUser;
|
import io.metersphere.commons.user.SessionUser;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
|
||||||
import io.metersphere.commons.utils.RsaUtil;
|
import io.metersphere.commons.utils.RsaUtil;
|
||||||
import io.metersphere.controller.handler.ResultHolder;
|
import io.metersphere.controller.handler.ResultHolder;
|
||||||
import io.metersphere.dto.ServiceDTO;
|
import io.metersphere.dto.ServiceDTO;
|
||||||
|
@ -57,21 +56,15 @@ public class LoginController {
|
||||||
if (StringUtils.isNotBlank(sessionId) && StringUtils.isNotBlank(csrfToken)) {
|
if (StringUtils.isNotBlank(sessionId) && StringUtils.isNotBlank(csrfToken)) {
|
||||||
userLoginService.validateCsrfToken(sessionId, csrfToken);
|
userLoginService.validateCsrfToken(sessionId, csrfToken);
|
||||||
Object userFromSession = redisSessionRepository.getSessionRedisOperations().opsForHash().get("spring:session:sessions:" + sessionId, "sessionAttr:user");
|
Object userFromSession = redisSessionRepository.getSessionRedisOperations().opsForHash().get("spring:session:sessions:" + sessionId, "sessionAttr:user");
|
||||||
if (userFromSession != null) {
|
if (userFromSession instanceof User) {
|
||||||
if (userFromSession instanceof User) {
|
// 用户只有工作空间权限
|
||||||
// 用户只有工作空间权限
|
if (StringUtils.isBlank(((User) userFromSession).getLastProjectId())) {
|
||||||
if (StringUtils.isBlank(((User) userFromSession).getLastProjectId())) {
|
((User) userFromSession).setLastProjectId("no_such_project");
|
||||||
((User) userFromSession).setLastProjectId("no_such_project");
|
|
||||||
}
|
|
||||||
// 使用数据库里的最新用户权限,不同的tab sessionId 不变
|
|
||||||
UserDTO userDTO = userLoginService.getUserDTO(((User) userFromSession).getId());
|
|
||||||
SessionUser sessionUser = SessionUser.fromUser(userDTO, sessionId);
|
|
||||||
return Mono.just(ResultHolder.success(sessionUser));
|
|
||||||
}
|
}
|
||||||
LogUtil.info("userFromSession.class: " + userFromSession.getClass().getName());
|
// 使用数据库里的最新用户权限,不同的tab sessionId 不变
|
||||||
return Mono.just(ResultHolder.success(userFromSession));
|
UserDTO userDTO = userLoginService.getUserDTO(((User) userFromSession).getId());
|
||||||
} else {
|
SessionUser sessionUser = SessionUser.fromUser(userDTO, sessionId);
|
||||||
LogUtil.info("userFromSession is null");
|
return Mono.just(ResultHolder.success(sessionUser));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Mono.just(ResultHolder.error(RsaUtil.getRsaKey().getPublicKey()));
|
return Mono.just(ResultHolder.error(RsaUtil.getRsaKey().getPublicKey()));
|
||||||
|
|
Loading…
Reference in New Issue