fix:优化传递token bug

This commit is contained in:
dongchunyu 2021-12-22 15:44:45 +08:00
parent 25cdfc3e55
commit 2c20e7baa0

View File

@ -32,8 +32,13 @@ public class SaTokenDubboConsumerFilter implements Filter {
RpcContext.getContext().setAttachment(SaIdUtil.ID_TOKEN, SaIdUtil.getToken());
}
// 1. 调用前向下传递会话Token
RpcContext.getContext().setAttachment(SaTokenConsts.JUST_CREATED, StpUtil.getTokenValueNotCut());
// 1. 调用前向下传递会话Token
String tokenValueNotCut = null;
try {
tokenValueNotCut = StpUtil.getTokenValueNotCut();
} finally {
RpcContext.getContext().setAttachment(SaTokenConsts.JUST_CREATED, tokenValueNotCut);
}
// 2. 开始调用
Result invoke = invoker.invoke(invocation);