From da69beed4de69bc7c7560a0fc1e91da471b15f36 Mon Sep 17 00:00:00 2001 From: Dmitry Telegin Date: Fri, 2 Feb 2024 21:50:29 +0000 Subject: [PATCH] CORS SPI - code review Signed-off-by: Dmitry Telegin --- .../src/main/java/org/keycloak/services/cors/CorsSpi.java | 4 +--- .../cors/{DefaultCorsImpl.java => DefaultCors.java} | 6 +++--- .../java/org/keycloak/services/cors/DefaultCorsFactory.java | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) rename services/src/main/java/org/keycloak/services/cors/{DefaultCorsImpl.java => DefaultCors.java} (98%) diff --git a/server-spi-private/src/main/java/org/keycloak/services/cors/CorsSpi.java b/server-spi-private/src/main/java/org/keycloak/services/cors/CorsSpi.java index db9e01e841..a24a453e3b 100644 --- a/server-spi-private/src/main/java/org/keycloak/services/cors/CorsSpi.java +++ b/server-spi-private/src/main/java/org/keycloak/services/cors/CorsSpi.java @@ -28,8 +28,6 @@ import org.keycloak.provider.Spi; */ public class CorsSpi implements Spi { - private static final String SPI_ID = "cors"; - @Override public boolean isInternal() { return true; @@ -37,7 +35,7 @@ public class CorsSpi implements Spi { @Override public String getName() { - return SPI_ID; + return "cors"; } @Override diff --git a/services/src/main/java/org/keycloak/services/cors/DefaultCorsImpl.java b/services/src/main/java/org/keycloak/services/cors/DefaultCors.java similarity index 98% rename from services/src/main/java/org/keycloak/services/cors/DefaultCorsImpl.java rename to services/src/main/java/org/keycloak/services/cors/DefaultCors.java index d752686ca0..18deca82b3 100755 --- a/services/src/main/java/org/keycloak/services/cors/DefaultCorsImpl.java +++ b/services/src/main/java/org/keycloak/services/cors/DefaultCors.java @@ -38,9 +38,9 @@ import org.keycloak.representations.AccessToken; /** * @author Stian Thorgersen */ -public class DefaultCorsImpl implements Cors { +public class DefaultCors implements Cors { - private static final Logger logger = Logger.getLogger(DefaultCorsImpl.class); + private static final Logger logger = Logger.getLogger(DefaultCors.class); private HttpRequest request; private ResponseBuilder builder; @@ -51,7 +51,7 @@ public class DefaultCorsImpl implements Cors { private boolean preflight; private boolean auth; - DefaultCorsImpl(HttpRequest request) { + DefaultCors(HttpRequest request) { this.request = request; } diff --git a/services/src/main/java/org/keycloak/services/cors/DefaultCorsFactory.java b/services/src/main/java/org/keycloak/services/cors/DefaultCorsFactory.java index b5a99b8b15..de301f5571 100644 --- a/services/src/main/java/org/keycloak/services/cors/DefaultCorsFactory.java +++ b/services/src/main/java/org/keycloak/services/cors/DefaultCorsFactory.java @@ -30,7 +30,7 @@ public class DefaultCorsFactory implements CorsFactory { @Override public Cors create(KeycloakSession session) { - return new DefaultCorsImpl(session.getContext().getHttpRequest()); + return new DefaultCors(session.getContext().getHttpRequest()); } @Override