添加匿名url

This commit is contained in:
duwenyuan 2025-12-24 09:21:38 +08:00
parent 7fc8fb5aa9
commit 8e0a954463

View File

@ -52,7 +52,7 @@ public class ShiroConfig {
/** /**
* Filter Chain定义说明 * Filter Chain定义说明
* * <p>
* 1一个URL可以配置多个Filter使用逗号分隔 * 1一个URL可以配置多个Filter使用逗号分隔
* 2当设置多个过滤器时全部验证通过才视为通过 * 2当设置多个过滤器时全部验证通过才视为通过
* 3部分过滤器可指定参数如permsroles * 3部分过滤器可指定参数如permsroles
@ -65,12 +65,12 @@ public class ShiroConfig {
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>(); Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
//支持yml方式配置拦截排除 //支持yml方式配置拦截排除
if(jeecgBaseConfig!=null && jeecgBaseConfig.getShiro()!=null){ if (jeecgBaseConfig != null && jeecgBaseConfig.getShiro() != null) {
String shiroExcludeUrls = jeecgBaseConfig.getShiro().getExcludeUrls(); String shiroExcludeUrls = jeecgBaseConfig.getShiro().getExcludeUrls();
if(oConvertUtils.isNotEmpty(shiroExcludeUrls)){ if (oConvertUtils.isNotEmpty(shiroExcludeUrls)) {
String[] permissionUrl = shiroExcludeUrls.split(","); String[] permissionUrl = shiroExcludeUrls.split(",");
for(String url : permissionUrl){ for (String url : permissionUrl) {
filterChainDefinitionMap.put(url,"anon"); filterChainDefinitionMap.put(url, "anon");
} }
} }
} }
@ -140,6 +140,14 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/newsWebsocket/**", "anon");//CMS模块 filterChainDefinitionMap.put("/newsWebsocket/**", "anon");//CMS模块
filterChainDefinitionMap.put("/vxeSocket/**", "anon");//JVxeTable无痕刷新示例 filterChainDefinitionMap.put("/vxeSocket/**", "anon");//JVxeTable无痕刷新示例
//邮件监控 排除
filterChainDefinitionMap.put("/sysEmailLog/getDashboardDailyStats", "anon");
filterChainDefinitionMap.put("/sysEmailLog/getRecentEmailDatas", "anon");
filterChainDefinitionMap.put("/sysEmail/sourceList", "anon");
//台站有效率
filterChainDefinitionMap.put("/stationOperation/getStationProvisionEff", "anon");
//性能监控安全隐患泄露TOEKNdurid连接池也有 //性能监控安全隐患泄露TOEKNdurid连接池也有
//filterChainDefinitionMap.put("/actuator/**", "anon"); //filterChainDefinitionMap.put("/actuator/**", "anon");
//测试模块排除 //测试模块排除
@ -149,7 +157,7 @@ public class ShiroConfig {
Map<String, Filter> filterMap = new HashMap<String, Filter>(1); Map<String, Filter> filterMap = new HashMap<String, Filter>(1);
//如果cloudServer为空 则说明是单体 需要加载跨域配置微服务跨域切换 //如果cloudServer为空 则说明是单体 需要加载跨域配置微服务跨域切换
Object cloudServer = env.getProperty(CommonConstant.CLOUD_SERVER_KEY); Object cloudServer = env.getProperty(CommonConstant.CLOUD_SERVER_KEY);
filterMap.put("jwt", new JwtFilter(cloudServer==null)); filterMap.put("jwt", new JwtFilter(cloudServer == null));
shiroFilterFactoryBean.setFilters(filterMap); shiroFilterFactoryBean.setFilters(filterMap);
// <!-- 过滤链定义从上向下顺序执行一般将/**放在最为下边 // <!-- 过滤链定义从上向下顺序执行一般将/**放在最为下边
filterChainDefinitionMap.put("/**", "jwt"); filterChainDefinitionMap.put("/**", "jwt");
@ -183,6 +191,7 @@ public class ShiroConfig {
/** /**
* 下面的代码是添加注解支持 * 下面的代码是添加注解支持
*
* @return * @return
*/ */
@Bean @Bean
@ -249,11 +258,11 @@ public class ShiroConfig {
redisManager.setPassword(lettuceConnectionFactory.getPassword()); redisManager.setPassword(lettuceConnectionFactory.getPassword());
} }
manager = redisManager; manager = redisManager;
}else{ } else {
// redis集群支持优先使用集群配置 // redis集群支持优先使用集群配置
RedisClusterManager redisManager = new RedisClusterManager(); RedisClusterManager redisManager = new RedisClusterManager();
Set<HostAndPort> portSet = new HashSet<>(); Set<HostAndPort> portSet = new HashSet<>();
lettuceConnectionFactory.getClusterConfiguration().getClusterNodes().forEach(node -> portSet.add(new HostAndPort(node.getHost() , node.getPort()))); lettuceConnectionFactory.getClusterConfiguration().getClusterNodes().forEach(node -> portSet.add(new HostAndPort(node.getHost(), node.getPort())));
//update-begin--Author:scott Date:20210531 for修改集群模式下未设置redis密码的bug issues/I3QNIC //update-begin--Author:scott Date:20210531 for修改集群模式下未设置redis密码的bug issues/I3QNIC
if (oConvertUtils.isNotEmpty(lettuceConnectionFactory.getPassword())) { if (oConvertUtils.isNotEmpty(lettuceConnectionFactory.getPassword())) {
JedisCluster jedisCluster = new JedisCluster(portSet, 2000, 2000, 5, JedisCluster jedisCluster = new JedisCluster(portSet, 2000, 2000, 5,