From 60b708a39c27c45886979c9b4996c83cfa165dfb Mon Sep 17 00:00:00 2001 From: Kai Helbig Date: Fri, 18 Oct 2024 12:35:31 +0200 Subject: [PATCH] remove deprecated kcinit route has been dropped in Keycloak with version 16 see https://github.com/keycloak/keycloak/issues/9106 Signed-off-by: Kai Helbig --- .../impl/dagger/ServerModule.java | 3 -- .../impl/handler/DelegationRoute.java | 46 ------------------- mock/src/main/resources/delegation.ftl | 12 ----- 3 files changed, 61 deletions(-) delete mode 100644 mock/src/main/java/com/tngtech/keycloakmock/impl/handler/DelegationRoute.java delete mode 100644 mock/src/main/resources/delegation.ftl diff --git a/mock/src/main/java/com/tngtech/keycloakmock/impl/dagger/ServerModule.java b/mock/src/main/java/com/tngtech/keycloakmock/impl/dagger/ServerModule.java index a580412..8ea3e51 100644 --- a/mock/src/main/java/com/tngtech/keycloakmock/impl/dagger/ServerModule.java +++ b/mock/src/main/java/com/tngtech/keycloakmock/impl/dagger/ServerModule.java @@ -4,7 +4,6 @@ import com.tngtech.keycloakmock.impl.UrlConfiguration; import com.tngtech.keycloakmock.impl.handler.AuthenticationRoute; import com.tngtech.keycloakmock.impl.handler.CommonHandler; -import com.tngtech.keycloakmock.impl.handler.DelegationRoute; import com.tngtech.keycloakmock.impl.handler.FailureHandler; import com.tngtech.keycloakmock.impl.handler.IFrameRoute; import com.tngtech.keycloakmock.impl.handler.JwksRoute; @@ -145,7 +144,6 @@ Router provideRouter( @Nonnull @Named("cookie1") ResourceFileHandler thirdPartyCookies1Route, @Nonnull @Named("cookie2") ResourceFileHandler thirdPartyCookies2Route, @Nonnull LogoutRoute logoutRoute, - @Nonnull DelegationRoute delegationRoute, @Nonnull OutOfBandLoginRoute outOfBandLoginRoute, @Nonnull @Named("keycloakJs") ResourceFileHandler keycloakJsRoute) { UrlConfiguration routing = defaultConfiguration.forRequestContext(null, ":realm"); @@ -179,7 +177,6 @@ Router provideRouter( .method(HttpMethod.GET) .method(HttpMethod.POST) .handler(logoutRoute); - router.get(routing.getOpenIdPath("delegated").getPath()).handler(delegationRoute); router.get(routing.getOutOfBandLoginLoginEndpoint().getPath()).handler(outOfBandLoginRoute); router.route("/auth/js/keycloak.js").handler(keycloakJsRoute); return router; diff --git a/mock/src/main/java/com/tngtech/keycloakmock/impl/handler/DelegationRoute.java b/mock/src/main/java/com/tngtech/keycloakmock/impl/handler/DelegationRoute.java deleted file mode 100644 index c398aec..0000000 --- a/mock/src/main/java/com/tngtech/keycloakmock/impl/handler/DelegationRoute.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.tngtech.keycloakmock.impl.handler; - -import io.vertx.core.Handler; -import io.vertx.core.http.HttpHeaders; -import io.vertx.ext.web.RoutingContext; -import io.vertx.ext.web.common.template.TemplateEngine; -import javax.annotation.Nonnull; -import javax.inject.Inject; -import javax.inject.Singleton; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@Singleton -public class DelegationRoute implements Handler { - private static final Logger LOG = LoggerFactory.getLogger(DelegationRoute.class); - private static final String HEADER = "header"; - private static final String BODY = "body"; - - @Nonnull private final TemplateEngine engine; - - @Inject - DelegationRoute(@Nonnull TemplateEngine engine) { - this.engine = engine; - } - - @Override - public void handle(@Nonnull RoutingContext routingContext) { - if ("true".equals(routingContext.queryParams().get("error"))) { - routingContext.put(HEADER, "Delegation failed"); - routingContext.put( - BODY, "You need to check the output of your client to see what went wrong."); - } else { - routingContext.put(HEADER, "Delegation successful"); - routingContext.put(BODY, "You may now close this browser window."); - } - engine - .render(routingContext.data(), "delegation.ftl") - .onSuccess( - b -> routingContext.response().putHeader(HttpHeaders.CONTENT_TYPE, "text/html").end(b)) - .onFailure( - t -> { - LOG.error("Unable to render login page", t); - routingContext.fail(t); - }); - } -} diff --git a/mock/src/main/resources/delegation.ftl b/mock/src/main/resources/delegation.ftl deleted file mode 100644 index 255add6..0000000 --- a/mock/src/main/resources/delegation.ftl +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Login result - - -

${header}

-

${body}

- -