2
0

style: 替换项目内所有ruoyi转为wfc

This commit is contained in:
TsMask
2024-11-26 17:34:02 +08:00
parent 77a28b06a3
commit fab448f836
300 changed files with 1211 additions and 1428 deletions

View File

@@ -7,7 +7,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
/**
* 网关启动程序
*
* @author ruoyi
* @author wfc
*/
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
public class WfcGatewayApplication

View File

@@ -10,7 +10,7 @@ import static com.google.code.kaptcha.Constants.*;
/**
* 验证码配置
*
* @author ruoyi
* @author wfc
*/
@Configuration
public class CaptchaConfig

View File

@@ -9,7 +9,7 @@ import org.wfc.gateway.handler.SentinelFallbackHandler;
/**
* 网关限流配置
*
* @author ruoyi
* @author wfc
*/
@Configuration
public class GatewayConfig

View File

@@ -6,7 +6,7 @@ import com.google.code.kaptcha.text.impl.DefaultTextCreator;
/**
* 验证码文本生成器
*
* @author ruoyi
* @author wfc
*/
public class KaptchaTextCreator extends DefaultTextCreator
{

View File

@@ -12,7 +12,7 @@ import org.wfc.gateway.handler.ValidateCodeHandler;
/**
* 路由配置信息
*
* @author ruoyi
* @author wfc
*/
@Configuration
public class RouterFunctionConfiguration

View File

@@ -19,7 +19,7 @@ import java.util.stream.Collectors;
/**
* SpringDoc配置类
*
* @author ruoyi
* @author wfc
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(value = "springdoc.api-docs.enabled", matchIfMissing = true)

View File

@@ -7,7 +7,7 @@ import org.springframework.context.annotation.Configuration;
/**
* 验证码配置
*
* @author ruoyi
* @author wfc
*/
@Configuration
@RefreshScope

View File

@@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration;
/**
* 放行白名单配置
*
* @author ruoyi
* @author wfc
*/
@Configuration
@RefreshScope

View File

@@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration;
/**
* XSS跨站脚本配置
*
* @author ruoyi
* @author wfc
*/
@Configuration
@RefreshScope

View File

@@ -24,7 +24,7 @@ import reactor.core.publisher.Mono;
/**
* 网关鉴权
*
* @author ruoyi
* @author wfc
*/
@Component
public class AuthFilter implements GlobalFilter, Ordered

View File

@@ -11,7 +11,7 @@ import org.wfc.common.core.utils.ServletUtils;
/**
* 黑名单过滤器
*
* @author ruoyi
* @author wfc
*/
@Component
public class BlackListUrlFilter extends AbstractGatewayFilterFactory<BlackListUrlFilter.Config>

View File

@@ -15,7 +15,7 @@ import reactor.core.publisher.Mono;
/**
* 获取body请求数据解决流不能重复读取问题
*
* @author ruoyi
* @author wfc
*/
@Component
public class CacheRequestFilter extends AbstractGatewayFilterFactory<CacheRequestFilter.Config>

View File

@@ -21,7 +21,7 @@ import reactor.core.publisher.Flux;
/**
* 验证码过滤器
*
* @author ruoyi
* @author wfc
*/
@Component
public class ValidateCodeFilter extends AbstractGatewayFilterFactory<Object>

View File

@@ -28,7 +28,7 @@ import reactor.core.publisher.Mono;
/**
* 跨站脚本过滤器
*
* @author ruoyi
* @author wfc
*/
@Component
@ConditionalOnProperty(value = "security.xss.enabled", havingValue = "true")

View File

@@ -15,7 +15,7 @@ import reactor.core.publisher.Mono;
/**
* 网关统一异常处理
*
* @author ruoyi
* @author wfc
*/
@Order(-1)
@Configuration

View File

@@ -11,7 +11,7 @@ import reactor.core.publisher.Mono;
/**
* 自定义限流异常处理
*
* @author ruoyi
* @author wfc
*/
public class SentinelFallbackHandler implements WebExceptionHandler
{

View File

@@ -16,7 +16,7 @@ import reactor.core.publisher.Mono;
/**
* 验证码获取
*
* @author ruoyi
* @author wfc
*/
@Component
public class ValidateCodeHandler implements HandlerFunction<ServerResponse>

View File

@@ -7,7 +7,7 @@ import org.wfc.common.core.web.domain.AjaxResult;
/**
* 验证码处理
*
* @author ruoyi
* @author wfc
*/
public interface ValidateCodeService
{

View File

@@ -2,6 +2,7 @@ package org.wfc.gateway.service.impl;
import com.google.code.kaptcha.Producer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.FastByteArrayOutputStream;
import org.wfc.common.core.constant.CacheConstants;
@@ -26,7 +27,7 @@ import java.util.concurrent.TimeUnit;
/**
* 验证码实现处理
*
* @author ruoyi
* @author wfc
*/
@Service
public class ValidateCodeServiceImpl implements ValidateCodeService
@@ -37,6 +38,9 @@ public class ValidateCodeServiceImpl implements ValidateCodeService
@Resource(name = "captchaProducerMath")
private Producer captchaProducerMath;
@Value("${spring.profiles.active}")
private String springProfilesActive;
@Autowired
private RedisService redisService;
@@ -94,6 +98,9 @@ public class ValidateCodeServiceImpl implements ValidateCodeService
Map<String, Object> data = new HashMap<>();
data.put("uuid", uuid);
data.put("img", Base64.encode(os.toByteArray()));
if ("dev".equals(springProfilesActive)) {
data.put("text", code);
}
return AjaxResult.success(data);
}

View File

@@ -0,0 +1,77 @@
spring:
redis:
host: 192.168.9.58
port: 16379
password: helloearth
cloud:
gateway:
discovery:
locator:
lowerCaseServiceId: true
enabled: true
routes:
# 认证中心
- id: wfc-auth
uri: lb://wfc-auth
predicates:
- Path=/auth/**
filters:
# 验证码处理
- CacheRequestFilter
- ValidateCodeFilter
- StripPrefix=1
# 代码生成
- id: wfc-gen
uri: lb://wfc-gen
predicates:
- Path=/code/**
filters:
- StripPrefix=1
# 定时任务
- id: wfc-job
uri: lb://wfc-job
predicates:
- Path=/schedule/**
filters:
- StripPrefix=1
# 系统模块
- id: wfc-system
uri: lb://wfc-system
predicates:
- Path=/system/**
filters:
- StripPrefix=1
# 文件服务
- id: wfc-file
uri: lb://wfc-file
predicates:
- Path=/file/**
filters:
- StripPrefix=1
# 用户平台模块
- id: wfc-modules-user
uri: lb://wfc-modules-user
predicates:
- Path=/u/**
filters:
- StripPrefix=1
# 安全配置
security:
# 验证码
captcha:
enabled: true
type: math
# 防止XSS攻击
xss:
enabled: true
excludeUrls:
- /system/notice
# 不校验白名单
ignore:
whites:
- /auth/logout
- /auth/login
- /auth/register
- /*/v2/api-docs
- /csrf