fix: token 判空

This commit is contained in:
xiongxiaoyang 2022-05-19 21:01:38 +08:00
parent cd8c937584
commit ee449134d0

View File

@ -6,6 +6,7 @@ import io.github.xxyopen.novel.core.constant.SystemConfigConsts;
import io.github.xxyopen.novel.core.util.JwtUtils; import io.github.xxyopen.novel.core.util.JwtUtils;
import io.github.xxyopen.novel.dto.UserInfoDto; import io.github.xxyopen.novel.dto.UserInfoDto;
import io.github.xxyopen.novel.manager.UserInfoCacheManager; import io.github.xxyopen.novel.manager.UserInfoCacheManager;
import org.springframework.util.StringUtils;
import java.util.Objects; import java.util.Objects;
@ -29,13 +30,13 @@ public interface AuthStrategy {
/** /**
* 前台多系统单点登录统一账号认证门户系统作家系统以及后面会扩展的漫画系统和视频系统等 * 前台多系统单点登录统一账号认证门户系统作家系统以及后面会扩展的漫画系统和视频系统等
* *
* @param jwtUtils jwt 工具 * @param jwtUtils jwt 工具
* @param userInfoCacheManager 用户缓存管理对象 * @param userInfoCacheManager 用户缓存管理对象
* @param token token 登录 token * @param token token 登录 token
* @return 用户ID * @return 用户ID
*/ */
default Long authSSO(JwtUtils jwtUtils, UserInfoCacheManager userInfoCacheManager, String token) { default Long authSSO(JwtUtils jwtUtils, UserInfoCacheManager userInfoCacheManager, String token) {
if (Objects.isNull(token)) { if (!StringUtils.hasText(token)) {
// token 为空 // token 为空
throw new BusinessException(ErrorCodeEnum.USER_LOGIN_EXPIRED); throw new BusinessException(ErrorCodeEnum.USER_LOGIN_EXPIRED);
} }