mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-14 14:19:08 +08:00
♻️ Refactoring code. 统一 Redis 序列化规则
This commit is contained in:
1 parent
9b3280ff5d
commit
8370878ace
9 files changed
+22
-22
No files matched your search
+4
-4
@@ -39,7 +39,7 @@ import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFac
|
||||
import org.springframework.cloud.gateway.filter.factory.rewrite.CachedBodyOutputMessage;
|
||||
import org.springframework.cloud.gateway.support.BodyInserterContext;
|
||||
import org.springframework.core.io.buffer.DataBuffer;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.codec.HttpMessageReader;
|
||||
@@ -79,7 +79,7 @@ public class PasswordDecoderFilter extends AbstractGatewayFilterFactory {
|
||||
|
||||
private static final String KEY_ALGORITHM = "AES";
|
||||
|
||||
private final RedisTemplate<String, String> redisTemplate;
|
||||
private final StringRedisTemplate redisTemplate;
|
||||
|
||||
private final GatewayConfigProperties gatewayConfig;
|
||||
|
||||
@@ -143,14 +143,14 @@ public class PasswordDecoderFilter extends AbstractGatewayFilterFactory {
|
||||
String key = String.format("%s:%s:%s", StrUtil.isBlank(tenantId) ? CommonConstants.TENANT_ID_1 : tenantId,
|
||||
CacheConstants.CLIENT_FLAG, clientId);
|
||||
|
||||
Object val = redisTemplate.opsForValue().get(key);
|
||||
String val = redisTemplate.opsForValue().get(key);
|
||||
|
||||
// 当配置不存在时,默认需要解密
|
||||
if (val == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
JSONObject information = JSONUtil.parseObj(val.toString());
|
||||
JSONObject information = JSONUtil.parseObj(val);
|
||||
if (StrUtil.equals(EncFlagTypeEnum.NO.getType(), information.getStr(CommonConstants.ENC_FLAG))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-2
@@ -37,7 +37,7 @@ import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.gateway.filter.GatewayFilter;
|
||||
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -56,7 +56,7 @@ import reactor.core.publisher.Mono;
|
||||
@SuppressWarnings("all")
|
||||
public class ValidateCodeGatewayFilter extends AbstractGatewayFilterFactory {
|
||||
|
||||
private final RedisTemplate<String, String> redisTemplate;
|
||||
private final StringRedisTemplate redisTemplate;
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ import io.springboot.captcha.ArithmeticCaptcha;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -49,7 +49,7 @@ public class ImageCodeMathHandler implements HandlerFunction<ServerResponse> {
|
||||
|
||||
private static final Integer DEFAULT_IMAGE_HEIGHT = 40;
|
||||
|
||||
private final RedisTemplate<String, String> redisTemplate;
|
||||
private final StringRedisTemplate redisTemplate;
|
||||
|
||||
@Override
|
||||
public Mono<ServerResponse> handle(ServerRequest serverRequest) {
|
||||
|
||||
Reference in new issue
Block a user