mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-10-21 02:57:23 +08:00
refactor: 将防火墙路由拦截的 path 配置改为 List<String> 数据类型
This commit is contained in:
@@ -19,6 +19,10 @@ import cn.dev33.satoken.context.model.SaRequest;
|
|||||||
import cn.dev33.satoken.context.model.SaResponse;
|
import cn.dev33.satoken.context.model.SaResponse;
|
||||||
import cn.dev33.satoken.exception.RequestPathInvalidException;
|
import cn.dev33.satoken.exception.RequestPathInvalidException;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 防火墙策略校验钩子函数:请求 path 黑名单校验
|
* 防火墙策略校验钩子函数:请求 path 黑名单校验
|
||||||
*
|
*
|
||||||
@@ -35,14 +39,15 @@ public class SaFirewallCheckHookForBlackPath implements SaFirewallCheckHook {
|
|||||||
/**
|
/**
|
||||||
* 请求 path 黑名单
|
* 请求 path 黑名单
|
||||||
*/
|
*/
|
||||||
public String[] blackPaths = {};
|
public List<String> blackPaths = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重载配置
|
* 重载配置
|
||||||
* @param paths 黑名单 path 列表
|
* @param paths 黑名单 path 列表
|
||||||
*/
|
*/
|
||||||
public void resetConfig(String... paths) {
|
public void resetConfig(String... paths) {
|
||||||
this.blackPaths = paths;
|
this.blackPaths.clear();
|
||||||
|
this.blackPaths.addAll(Arrays.asList(paths));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -19,6 +19,10 @@ import cn.dev33.satoken.context.model.SaRequest;
|
|||||||
import cn.dev33.satoken.context.model.SaResponse;
|
import cn.dev33.satoken.context.model.SaResponse;
|
||||||
import cn.dev33.satoken.exception.StopMatchException;
|
import cn.dev33.satoken.exception.StopMatchException;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 防火墙策略校验钩子函数:请求 path 白名单放行
|
* 防火墙策略校验钩子函数:请求 path 白名单放行
|
||||||
*
|
*
|
||||||
@@ -35,14 +39,15 @@ public class SaFirewallCheckHookForWhitePath implements SaFirewallCheckHook {
|
|||||||
/**
|
/**
|
||||||
* 请求 path 白名单
|
* 请求 path 白名单
|
||||||
*/
|
*/
|
||||||
public String[] whitePaths = {};
|
public List<String> whitePaths = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重载配置
|
* 重载配置
|
||||||
* @param paths 白名单 path 列表
|
* @param paths 白名单 path 列表
|
||||||
*/
|
*/
|
||||||
public void resetConfig(String... paths) {
|
public void resetConfig(String... paths) {
|
||||||
this.whitePaths = paths;
|
this.whitePaths.clear();
|
||||||
|
this.whitePaths.addAll(Arrays.asList(paths));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -3,7 +3,6 @@ package com.pj.satoken;
|
|||||||
import cn.dev33.satoken.context.SaHolder;
|
import cn.dev33.satoken.context.SaHolder;
|
||||||
import cn.dev33.satoken.filter.SaServletFilter;
|
import cn.dev33.satoken.filter.SaServletFilter;
|
||||||
import cn.dev33.satoken.interceptor.SaInterceptor;
|
import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||||
import cn.dev33.satoken.plugin.SaTokenPluginForJackson;
|
|
||||||
import cn.dev33.satoken.plugin.SaTokenPluginHolder;
|
import cn.dev33.satoken.plugin.SaTokenPluginHolder;
|
||||||
import cn.dev33.satoken.router.SaHttpMethod;
|
import cn.dev33.satoken.router.SaHttpMethod;
|
||||||
import cn.dev33.satoken.router.SaRouter;
|
import cn.dev33.satoken.router.SaRouter;
|
||||||
|
Reference in New Issue
Block a user