Browse Source

网关国际化改造08

master
caojianbin 2 years ago
parent
commit
48c7cd34bc
  1. 2
      ruoyi-gateway/src/main/java/com/yisai/gateway/RuoYiGatewayApplication.java
  2. 2
      ruoyi-gateway/src/main/java/com/yisai/gateway/config/CaptchaConfig.java
  3. 4
      ruoyi-gateway/src/main/java/com/yisai/gateway/config/GatewayConfig.java
  4. 2
      ruoyi-gateway/src/main/java/com/yisai/gateway/config/KaptchaTextCreator.java
  5. 4
      ruoyi-gateway/src/main/java/com/yisai/gateway/config/RouterFunctionConfiguration.java
  6. 2
      ruoyi-gateway/src/main/java/com/yisai/gateway/config/SwaggerProvider.java
  7. 2
      ruoyi-gateway/src/main/java/com/yisai/gateway/config/properties/CaptchaProperties.java
  8. 2
      ruoyi-gateway/src/main/java/com/yisai/gateway/config/properties/IgnoreWhiteProperties.java
  9. 2
      ruoyi-gateway/src/main/java/com/yisai/gateway/config/properties/XssProperties.java
  10. 7
      ruoyi-gateway/src/main/java/com/yisai/gateway/constant/MessagesConstant.java
  11. 6
      ruoyi-gateway/src/main/java/com/yisai/gateway/filter/AuthFilter.java
  12. 4
      ruoyi-gateway/src/main/java/com/yisai/gateway/filter/BlackListUrlFilter.java
  13. 2
      ruoyi-gateway/src/main/java/com/yisai/gateway/filter/CacheRequestFilter.java
  14. 7
      ruoyi-gateway/src/main/java/com/yisai/gateway/filter/ValidateCodeFilter.java
  15. 4
      ruoyi-gateway/src/main/java/com/yisai/gateway/filter/XssFilter.java
  16. 4
      ruoyi-gateway/src/main/java/com/yisai/gateway/handler/GatewayExceptionHandler.java
  17. 2
      ruoyi-gateway/src/main/java/com/yisai/gateway/handler/SentinelFallbackHandler.java
  18. 2
      ruoyi-gateway/src/main/java/com/yisai/gateway/handler/SwaggerHandler.java
  19. 4
      ruoyi-gateway/src/main/java/com/yisai/gateway/handler/ValidateCodeHandler.java
  20. 2
      ruoyi-gateway/src/main/java/com/yisai/gateway/service/ValidateCodeService.java
  21. 6
      ruoyi-gateway/src/main/java/com/yisai/gateway/service/impl/ValidateCodeServiceImpl.java

2
ruoyi-gateway/src/main/java/com/ruoyi/gateway/RuoYiGatewayApplication.java → ruoyi-gateway/src/main/java/com/yisai/gateway/RuoYiGatewayApplication.java

@ -1,4 +1,4 @@
package com.ruoyi.gateway; package com.yisai.gateway;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;

2
ruoyi-gateway/src/main/java/com/ruoyi/gateway/config/CaptchaConfig.java → ruoyi-gateway/src/main/java/com/yisai/gateway/config/CaptchaConfig.java

@ -1,4 +1,4 @@
package com.ruoyi.gateway.config; package com.yisai.gateway.config;
import java.util.Properties; import java.util.Properties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;

4
ruoyi-gateway/src/main/java/com/ruoyi/gateway/config/GatewayConfig.java → ruoyi-gateway/src/main/java/com/yisai/gateway/config/GatewayConfig.java

@ -1,10 +1,10 @@
package com.ruoyi.gateway.config; package com.yisai.gateway.config;
import com.yisai.gateway.handler.SentinelFallbackHandler;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import com.ruoyi.gateway.handler.SentinelFallbackHandler;
/** /**
* 网关限流配置 * 网关限流配置

2
ruoyi-gateway/src/main/java/com/ruoyi/gateway/config/KaptchaTextCreator.java → ruoyi-gateway/src/main/java/com/yisai/gateway/config/KaptchaTextCreator.java

@ -1,4 +1,4 @@
package com.ruoyi.gateway.config; package com.yisai.gateway.config;
import java.util.Random; import java.util.Random;
import com.google.code.kaptcha.text.impl.DefaultTextCreator; import com.google.code.kaptcha.text.impl.DefaultTextCreator;

4
ruoyi-gateway/src/main/java/com/ruoyi/gateway/config/RouterFunctionConfiguration.java → ruoyi-gateway/src/main/java/com/yisai/gateway/config/RouterFunctionConfiguration.java

@ -1,5 +1,6 @@
package com.ruoyi.gateway.config; package com.yisai.gateway.config;
import com.yisai.gateway.handler.ValidateCodeHandler;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -7,7 +8,6 @@ import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.RequestPredicates; import org.springframework.web.reactive.function.server.RequestPredicates;
import org.springframework.web.reactive.function.server.RouterFunction; import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions; import org.springframework.web.reactive.function.server.RouterFunctions;
import com.ruoyi.gateway.handler.ValidateCodeHandler;
/** /**
* 路由配置信息 * 路由配置信息

2
ruoyi-gateway/src/main/java/com/ruoyi/gateway/config/SwaggerProvider.java → ruoyi-gateway/src/main/java/com/yisai/gateway/config/SwaggerProvider.java

@ -1,4 +1,4 @@
package com.ruoyi.gateway.config; package com.yisai.gateway.config;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

2
ruoyi-gateway/src/main/java/com/ruoyi/gateway/config/properties/CaptchaProperties.java → ruoyi-gateway/src/main/java/com/yisai/gateway/config/properties/CaptchaProperties.java

@ -1,4 +1,4 @@
package com.ruoyi.gateway.config.properties; package com.yisai.gateway.config.properties;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.context.config.annotation.RefreshScope;

2
ruoyi-gateway/src/main/java/com/ruoyi/gateway/config/properties/IgnoreWhiteProperties.java → ruoyi-gateway/src/main/java/com/yisai/gateway/config/properties/IgnoreWhiteProperties.java

@ -1,4 +1,4 @@
package com.ruoyi.gateway.config.properties; package com.yisai.gateway.config.properties;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

2
ruoyi-gateway/src/main/java/com/ruoyi/gateway/config/properties/XssProperties.java → ruoyi-gateway/src/main/java/com/yisai/gateway/config/properties/XssProperties.java

@ -1,4 +1,4 @@
package com.ruoyi.gateway.config.properties; package com.yisai.gateway.config.properties;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

7
ruoyi-gateway/src/main/java/com/ruoyi/gateway/constant/MessagesConstant.java → ruoyi-gateway/src/main/java/com/yisai/gateway/constant/MessagesConstant.java

@ -1,14 +1,9 @@
package com.ruoyi.gateway.constant; package com.yisai.gateway.constant;
import com.ruoyi.gateway.filter.AuthFilter;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
import java.util.List;
import java.util.Locale;
import java.util.logging.Logger;
public class MessagesConstant { public class MessagesConstant {
private static final org.slf4j.Logger log = LoggerFactory.getLogger(MessagesConstant.class); private static final org.slf4j.Logger log = LoggerFactory.getLogger(MessagesConstant.class);
/**令牌不能为空*/ /**令牌不能为空*/

6
ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/AuthFilter.java → ruoyi-gateway/src/main/java/com/yisai/gateway/filter/AuthFilter.java

@ -1,6 +1,6 @@
package com.ruoyi.gateway.filter; package com.yisai.gateway.filter;
import com.ruoyi.gateway.constant.MessagesConstant; import com.yisai.gateway.constant.MessagesConstant;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -18,7 +18,7 @@ import com.ruoyi.common.core.utils.JwtUtils;
import com.ruoyi.common.core.utils.ServletUtils; import com.ruoyi.common.core.utils.ServletUtils;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.gateway.config.properties.IgnoreWhiteProperties; import com.yisai.gateway.config.properties.IgnoreWhiteProperties;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;

4
ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/BlackListUrlFilter.java → ruoyi-gateway/src/main/java/com/yisai/gateway/filter/BlackListUrlFilter.java

@ -1,10 +1,10 @@
package com.ruoyi.gateway.filter; package com.yisai.gateway.filter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import com.ruoyi.gateway.constant.MessagesConstant; import com.yisai.gateway.constant.MessagesConstant;
import org.springframework.cloud.gateway.filter.GatewayFilter; import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory; import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;

2
ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/CacheRequestFilter.java → ruoyi-gateway/src/main/java/com/yisai/gateway/filter/CacheRequestFilter.java

@ -1,4 +1,4 @@
package com.ruoyi.gateway.filter; package com.yisai.gateway.filter;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;

7
ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/ValidateCodeFilter.java → ruoyi-gateway/src/main/java/com/yisai/gateway/filter/ValidateCodeFilter.java

@ -1,8 +1,11 @@
package com.ruoyi.gateway.filter; package com.yisai.gateway.filter;
import java.nio.CharBuffer; import java.nio.CharBuffer;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import com.yisai.gateway.config.properties.CaptchaProperties;
import com.yisai.gateway.service.ValidateCodeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.filter.GatewayFilter; import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory; import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
@ -14,8 +17,6 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.utils.ServletUtils; import com.ruoyi.common.core.utils.ServletUtils;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.gateway.config.properties.CaptchaProperties;
import com.ruoyi.gateway.service.ValidateCodeService;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
/** /**

4
ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/XssFilter.java → ruoyi-gateway/src/main/java/com/yisai/gateway/filter/XssFilter.java

@ -1,4 +1,4 @@
package com.ruoyi.gateway.filter; package com.yisai.gateway.filter;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -20,7 +20,7 @@ import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.ServerWebExchange;
import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.html.EscapeUtil; import com.ruoyi.common.core.utils.html.EscapeUtil;
import com.ruoyi.gateway.config.properties.XssProperties; import com.yisai.gateway.config.properties.XssProperties;
import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.ByteBufAllocator;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;

4
ruoyi-gateway/src/main/java/com/ruoyi/gateway/handler/GatewayExceptionHandler.java → ruoyi-gateway/src/main/java/com/yisai/gateway/handler/GatewayExceptionHandler.java

@ -1,6 +1,6 @@
package com.ruoyi.gateway.handler; package com.yisai.gateway.handler;
import com.ruoyi.gateway.constant.MessagesConstant; import com.yisai.gateway.constant.MessagesConstant;
import org.springframework.cloud.gateway.support.NotFoundException; import org.springframework.cloud.gateway.support.NotFoundException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

2
ruoyi-gateway/src/main/java/com/ruoyi/gateway/handler/SentinelFallbackHandler.java → ruoyi-gateway/src/main/java/com/yisai/gateway/handler/SentinelFallbackHandler.java

@ -1,4 +1,4 @@
package com.ruoyi.gateway.handler; package com.yisai.gateway.handler;
import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.GatewayCallbackManager; import com.alibaba.csp.sentinel.adapter.gateway.sc.callback.GatewayCallbackManager;
import com.alibaba.csp.sentinel.slots.block.BlockException; import com.alibaba.csp.sentinel.slots.block.BlockException;

2
ruoyi-gateway/src/main/java/com/ruoyi/gateway/handler/SwaggerHandler.java → ruoyi-gateway/src/main/java/com/yisai/gateway/handler/SwaggerHandler.java

@ -1,4 +1,4 @@
package com.ruoyi.gateway.handler; package com.yisai.gateway.handler;
import java.util.Optional; import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

4
ruoyi-gateway/src/main/java/com/ruoyi/gateway/handler/ValidateCodeHandler.java → ruoyi-gateway/src/main/java/com/yisai/gateway/handler/ValidateCodeHandler.java

@ -1,4 +1,4 @@
package com.ruoyi.gateway.handler; package com.yisai.gateway.handler;
import java.io.IOException; import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -10,7 +10,7 @@ import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse; import org.springframework.web.reactive.function.server.ServerResponse;
import com.ruoyi.common.core.exception.CaptchaException; import com.ruoyi.common.core.exception.CaptchaException;
import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.gateway.service.ValidateCodeService; import com.yisai.gateway.service.ValidateCodeService;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
/** /**

2
ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/ValidateCodeService.java → ruoyi-gateway/src/main/java/com/yisai/gateway/service/ValidateCodeService.java

@ -1,4 +1,4 @@
package com.ruoyi.gateway.service; package com.yisai.gateway.service;
import java.io.IOException; import java.io.IOException;
import com.ruoyi.common.core.exception.CaptchaException; import com.ruoyi.common.core.exception.CaptchaException;

6
ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/impl/ValidateCodeServiceImpl.java → ruoyi-gateway/src/main/java/com/yisai/gateway/service/impl/ValidateCodeServiceImpl.java

@ -1,4 +1,4 @@
package com.ruoyi.gateway.service.impl; package com.yisai.gateway.service.impl;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
@ -16,8 +16,8 @@ import com.ruoyi.common.core.utils.sign.Base64;
import com.ruoyi.common.core.utils.uuid.IdUtils; import com.ruoyi.common.core.utils.uuid.IdUtils;
import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.redis.service.RedisService; import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.gateway.config.properties.CaptchaProperties; import com.yisai.gateway.config.properties.CaptchaProperties;
import com.ruoyi.gateway.service.ValidateCodeService; import com.yisai.gateway.service.ValidateCodeService;
/** /**
* 验证码实现处理 * 验证码实现处理
Loading…
Cancel
Save