feat(sj_1.1.0-beta3): 下线客户端默认token兜底逻辑

This commit is contained in:
opensnail 2024-07-10 23:49:10 +08:00
parent ef94f54d3e
commit a745a2d527
2 changed files with 2 additions and 2 deletions

View File

@ -37,7 +37,7 @@ public class CacheToken implements Lifecycle {
AccessTemplate template = SpringContext.getBean(AccessTemplate.class);
GroupConfig config = template.getGroupConfigAccess().getGroupConfigByGroupName(groupName, namespaceId);
if (Objects.isNull(config)) {
return SystemConstants.DEFAULT_TOKEN;
return StrUtil.EMPTY;
}
token = config.getToken();

View File

@ -87,7 +87,7 @@ public class RequestHandlerActor extends AbstractActor {
String namespace = headers.get(HeadersEnum.NAMESPACE.getKey());
String token = headers.get(HeadersEnum.TOKEN.getKey());
if (!CacheToken.get(groupName, namespace).equals(token)) {
if (StrUtil.isBlank(token) || !CacheToken.get(groupName, namespace).equals(token)) {
SnailJobLog.LOCAL.error("Token authentication failed. [{}]", token);
return JsonUtil.toJsonString(new Result<>(0, "Token authentication failed"));
}