mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-09-18 09:44:31 +08:00
refactor: sa-token-solon-plugin 优化 Gateway 接口的处理(避免使用路由接口)
This commit is contained in:
@@ -26,7 +26,6 @@ import cn.dev33.satoken.solon.util.SaSolonOperateUtil;
|
||||
import cn.dev33.satoken.strategy.SaAnnotationStrategy;
|
||||
import org.noear.solon.Solon;
|
||||
import org.noear.solon.core.handle.*;
|
||||
import org.noear.solon.core.route.RoutingTable;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
@@ -161,10 +160,9 @@ public class SaTokenFilter implements SaFilter, Filter { //之所以改名,为
|
||||
if (mainHandler instanceof Gateway) {
|
||||
//支持网关处理
|
||||
Gateway gateway = (Gateway) mainHandler;
|
||||
RoutingTable<Handler> mainRouting = gateway.getMainRouting();
|
||||
MethodType method = MethodTypeUtil.valueOf(ctx.method());
|
||||
mainHandler = mainRouting.matchOne(ctx.pathNew(), method);
|
||||
mainHandler = gateway.find(ctx);
|
||||
}
|
||||
|
||||
Action action = (mainHandler instanceof Action ? (Action) mainHandler : null);
|
||||
|
||||
//1.执行前置处理(主要是一些跨域之类的)
|
||||
|
@@ -27,7 +27,6 @@ import cn.dev33.satoken.strategy.SaAnnotationStrategy;
|
||||
import org.noear.solon.core.handle.*;
|
||||
import org.noear.solon.core.route.RouterInterceptor;
|
||||
import org.noear.solon.core.route.RouterInterceptorChain;
|
||||
import org.noear.solon.core.route.RoutingTable;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
@@ -197,9 +196,7 @@ public class SaTokenInterceptor implements SaFilter, RouterInterceptor {
|
||||
if (mainHandler instanceof Gateway) {
|
||||
//支持网关处理
|
||||
Gateway gateway = (Gateway) mainHandler;
|
||||
RoutingTable<Handler> mainRouting = gateway.getMainRouting();
|
||||
MethodType method = MethodTypeUtil.valueOf(ctx.method());
|
||||
mainHandler = mainRouting.matchOne(ctx.pathNew(), method);
|
||||
mainHandler = gateway.find(ctx);
|
||||
}
|
||||
|
||||
Action action = (mainHandler instanceof Action ? (Action) mainHandler : null);
|
||||
|
Reference in New Issue
Block a user