feat(sj_1.1.0-beta3): 下线客户端默认token兜底逻辑
This commit is contained in:
parent
ef94f54d3e
commit
a745a2d527
@ -37,7 +37,7 @@ public class CacheToken implements Lifecycle {
|
|||||||
AccessTemplate template = SpringContext.getBean(AccessTemplate.class);
|
AccessTemplate template = SpringContext.getBean(AccessTemplate.class);
|
||||||
GroupConfig config = template.getGroupConfigAccess().getGroupConfigByGroupName(groupName, namespaceId);
|
GroupConfig config = template.getGroupConfigAccess().getGroupConfigByGroupName(groupName, namespaceId);
|
||||||
if (Objects.isNull(config)) {
|
if (Objects.isNull(config)) {
|
||||||
return SystemConstants.DEFAULT_TOKEN;
|
return StrUtil.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
token = config.getToken();
|
token = config.getToken();
|
||||||
|
@ -87,7 +87,7 @@ public class RequestHandlerActor extends AbstractActor {
|
|||||||
String namespace = headers.get(HeadersEnum.NAMESPACE.getKey());
|
String namespace = headers.get(HeadersEnum.NAMESPACE.getKey());
|
||||||
String token = headers.get(HeadersEnum.TOKEN.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);
|
SnailJobLog.LOCAL.error("Token authentication failed. [{}]", token);
|
||||||
return JsonUtil.toJsonString(new Result<>(0, "Token authentication failed"));
|
return JsonUtil.toJsonString(new Result<>(0, "Token authentication failed"));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user