格式修改
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.baiyue.gateway.config;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.data.redis.core.ReactiveStringRedisTemplate;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -15,17 +17,9 @@ import reactor.core.publisher.Mono;
|
||||
*/
|
||||
@Component
|
||||
public class RedisTokenSessionWebFilter implements WebFilter {
|
||||
private final ReactiveStringRedisTemplate redisTemplate;
|
||||
private final GatewaySecurityProperties properties;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public RedisTokenSessionWebFilter(ReactiveStringRedisTemplate redisTemplate,
|
||||
GatewaySecurityProperties properties,
|
||||
ObjectMapper objectMapper) {
|
||||
this.redisTemplate = redisTemplate;
|
||||
this.properties = properties;
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
@Resource private ReactiveStringRedisTemplate reactiveStringRedisTemplate;
|
||||
@Resource private GatewaySecurityProperties properties;
|
||||
@Resource private ObjectMapper objectMapper;
|
||||
|
||||
@Override
|
||||
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
|
||||
@@ -40,7 +34,7 @@ public class RedisTokenSessionWebFilter implements WebFilter {
|
||||
WebFilterChain chain) {
|
||||
String jwtId = jwt.getToken().getId();
|
||||
if (jwtId == null || jwtId.isBlank()) return unauthorized(exchange);
|
||||
return redisTemplate.hasKey(properties.accessTokenKey(jwtId))
|
||||
return reactiveStringRedisTemplate.hasKey(properties.accessTokenKey(jwtId))
|
||||
.onErrorReturn(false)
|
||||
.flatMap(active -> Boolean.TRUE.equals(active)
|
||||
? chain.filter(exchange) : unauthorized(exchange));
|
||||
|
||||
@@ -216,6 +216,6 @@ logging:
|
||||
rollingpolicy:
|
||||
file-name-pattern: "${LOGGING_ROLLING_FILE_NAME_PATTERN:${LOG_PATH:./logs}/${spring.application.name}.%d{yyyy-MM-dd}.%i.log.gz}"
|
||||
max-file-size: "${LOGGING_ROLLING_MAX_FILE_SIZE:100MB}"
|
||||
max-history: "${LOGGING_ROLLING_MAX_HISTORY:30}"
|
||||
max-history: "${LOGGING_ROLLING_MAX_HISTORY:7}"
|
||||
total-size-cap: "${LOGGING_ROLLING_TOTAL_SIZE_CAP:5GB}"
|
||||
clean-history-on-start: "${LOGGING_ROLLING_CLEAN_HISTORY_ON_START:false}"
|
||||
|
||||
@@ -9,7 +9,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class Phase2InboundRouteContractTest {
|
||||
@Test
|
||||
void 网关覆盖平台入库计费客户端费用和测量图片路径() throws Exception {
|
||||
void shouldHandleCase01() throws Exception {
|
||||
String yaml = new ClassPathResource("application.yml")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
assertThat(yaml)
|
||||
|
||||
Reference in New Issue
Block a user