From e68eb8f66dfec16ee677c52fded7967d9f9b4203 Mon Sep 17 00:00:00 2001 From: AlexBob <5199840@qq.com> Date: Wed, 29 May 2024 15:08:15 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BA=86=20SessionConfiguration.java=20=E5=92=8C=20R2?= =?UTF-8?q?dbcConfiguration.java=20=E6=96=87=E4=BB=B6=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/platform/boot/config/R2dbcConfiguration.java | 7 ++----- .../com/platform/boot/config/SessionConfiguration.java | 7 +++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/boot/platform/src/main/java/com/platform/boot/config/R2dbcConfiguration.java b/boot/platform/src/main/java/com/platform/boot/config/R2dbcConfiguration.java index de7b17ce..f7b87f0e 100644 --- a/boot/platform/src/main/java/com/platform/boot/config/R2dbcConfiguration.java +++ b/boot/platform/src/main/java/com/platform/boot/config/R2dbcConfiguration.java @@ -12,7 +12,6 @@ import org.springframework.data.domain.ReactiveAuditorAware; import org.springframework.data.r2dbc.config.AbstractR2dbcConfiguration; import org.springframework.data.r2dbc.config.EnableR2dbcAuditing; -import org.springframework.lang.NonNull; import org.springframework.transaction.annotation.EnableTransactionManagement; import java.util.List; @@ -28,15 +27,13 @@ public class R2dbcConfiguration extends AbstractR2dbcConfiguration { private final List> customConverters; - @NonNull @Override - public ConnectionFactory connectionFactory() { + public @lombok.NonNull ConnectionFactory connectionFactory() { return ConnectionFactories.get("r2dbc:.."); } - @NonNull @Override - public List getCustomConverters() { + public @lombok.NonNull List getCustomConverters() { return Lists.newArrayList(customConverters); } diff --git a/boot/platform/src/main/java/com/platform/boot/config/SessionConfiguration.java b/boot/platform/src/main/java/com/platform/boot/config/SessionConfiguration.java index b3960f7e..97d3e8a5 100644 --- a/boot/platform/src/main/java/com/platform/boot/config/SessionConfiguration.java +++ b/boot/platform/src/main/java/com/platform/boot/config/SessionConfiguration.java @@ -32,6 +32,8 @@ public class SessionConfiguration { public static final String HEADER_SESSION_ID_NAME = "X-Auth-Token"; public static final String X_REQUESTED_WITH = "X-Requested-With"; public static final String XML_HTTP_REQUEST = "XMLHttpRequest"; + public static final Pattern AUTHORIZATION_PATTERN = Pattern.compile( + "^Bearer (?[a-zA-Z0-9-._~+/]+=*)$", Pattern.CASE_INSENSITIVE); @Bean @Primary @@ -48,8 +50,6 @@ public WebSessionIdResolver webSessionIdResolver() { } static class CustomWebSessionIdResolver extends HeaderWebSessionIdResolver { - private static final Pattern AUTHORIZATION_PATTERN = Pattern.compile("^Bearer (?[a-zA-Z0-9-._~+/]+=*)$", - Pattern.CASE_INSENSITIVE); private final CookieWebSessionIdResolver cookieWebSessionIdResolver = new CookieWebSessionIdResolver(); @@ -62,9 +62,8 @@ public void setSessionId(@NonNull ServerWebExchange exchange, @NonNull String id } } - @NonNull @Override - public List resolveSessionIds(@NonNull ServerWebExchange exchange) { + public @NonNull List resolveSessionIds(@NonNull ServerWebExchange exchange) { List requestedWith; HttpHeaders httpHeaders = exchange.getRequest().getHeaders(); if (XML_HTTP_REQUEST.equalsIgnoreCase(httpHeaders.getFirst(X_REQUESTED_WITH))) {