update 优化 替换 sa-token 过期方法

2.X
疯狂的狮子li 2 years ago
parent 908e112187
commit 73c003d8de

@ -2,7 +2,7 @@ package cn.dev33.satoken.context.dubbo.filter;
import cn.dev33.satoken.SaManager;
import cn.dev33.satoken.context.SaTokenContextDefaultImpl;
import cn.dev33.satoken.id.SaIdUtil;
import cn.dev33.satoken.same.SaSameUtil;
import cn.dev33.satoken.spring.SaBeanInject;
import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaTokenConsts;
@ -29,8 +29,8 @@ public class SaTokenDubboConsumerFilter implements Filter {
SpringUtils.getBean(SaBeanInject.class);
// 追加 Id-Token 参数
if(SaManager.getConfig().getCheckIdToken()) {
RpcContext.getServiceContext().setAttachment(SaIdUtil.ID_TOKEN, SaIdUtil.getToken());
if(SaManager.getConfig().getCheckSameToken()) {
RpcContext.getServiceContext().setAttachment(SaSameUtil.SAME_TOKEN, SaSameUtil.getToken());
}
// 1. 调用前向下传递会话Token

@ -1,7 +1,7 @@
package cn.dev33.satoken.context.dubbo.filter;
import cn.dev33.satoken.SaManager;
import cn.dev33.satoken.id.SaIdUtil;
import cn.dev33.satoken.same.SaSameUtil;
import cn.dev33.satoken.spring.SaBeanInject;
import com.ruoyi.common.core.utils.SpringUtils;
import org.apache.dubbo.common.constants.CommonConstants;
@ -26,9 +26,9 @@ public class SaTokenDubboProviderFilter implements Filter {
SpringUtils.getBean(SaBeanInject.class);
// RPC 调用鉴权
if(SaManager.getConfig().getCheckIdToken()) {
String idToken = invocation.getAttachment(SaIdUtil.ID_TOKEN);
SaIdUtil.checkToken(idToken);
if(SaManager.getConfig().getCheckSameToken()) {
String idToken = invocation.getAttachment(SaSameUtil.SAME_TOKEN);
SaSameUtil.checkToken(idToken);
}
// 开始调用

Loading…
Cancel
Save