diff --git a/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java b/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java index 4ed2986a9f..31ed45f3d9 100644 --- a/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java +++ b/quarkus/deployment/src/main/java/org/keycloak/quarkus/deployment/KeycloakProcessor.java @@ -45,7 +45,6 @@ import io.quarkus.hibernate.orm.deployment.spi.AdditionalJpaModelBuildItem; import io.quarkus.resteasy.reactive.server.spi.MethodScannerBuildItem; import io.quarkus.runtime.configuration.ConfigurationException; import io.quarkus.runtime.configuration.ProfileManager; -import io.quarkus.vertx.http.deployment.RouteBuildItem; import io.smallrye.config.ConfigValue; import org.eclipse.microprofile.health.Readiness; import org.hibernate.cfg.AvailableSettings; @@ -94,7 +93,6 @@ import org.keycloak.quarkus.runtime.configuration.QuarkusPropertiesConfigSource; import org.keycloak.quarkus.runtime.configuration.mappers.PropertyMapper; import org.keycloak.quarkus.runtime.configuration.mappers.PropertyMappers; import org.keycloak.quarkus.runtime.integration.resteasy.KeycloakHandlerChainCustomizer; -import org.keycloak.quarkus.runtime.integration.web.NotFoundHandler; import org.keycloak.quarkus.runtime.services.health.KeycloakReadyHealthCheck; import org.keycloak.quarkus.runtime.storage.database.jpa.NamedJpaConnectionProviderFactory; import org.keycloak.quarkus.runtime.themes.FlatClasspathThemeResourceProviderFactory; @@ -147,8 +145,6 @@ import java.util.logging.Handler; import static org.keycloak.connections.jpa.util.JpaUtils.loadSpecificNamedQueries; import static org.keycloak.quarkus.runtime.Environment.getCurrentOrCreateFeatureProfile; import static org.keycloak.quarkus.runtime.Environment.getProviderFiles; -import static org.keycloak.quarkus.runtime.KeycloakRecorder.DEFAULT_HEALTH_ENDPOINT; -import static org.keycloak.quarkus.runtime.KeycloakRecorder.DEFAULT_METRICS_ENDPOINT; import static org.keycloak.quarkus.runtime.Providers.getProviderManager; import static org.keycloak.quarkus.runtime.configuration.Configuration.getOptionalKcValue; import static org.keycloak.quarkus.runtime.configuration.Configuration.getOptionalValue; @@ -600,24 +596,8 @@ class KeycloakProcessor { } @BuildStep - void disableMetricsEndpoint(BuildProducer routes) { - if (!isMetricsEnabled()) { - routes.produce(RouteBuildItem.builder().route(DEFAULT_METRICS_ENDPOINT.concat("/*")).handler(new NotFoundHandler()).build()); - } - } - - @BuildStep - void disableHealthEndpoint(BuildProducer routes, BuildProducer removeBeans, - CombinedIndexBuildItem index) { - boolean healthDisabled = !isHealthEnabled(); - - if (healthDisabled) { - routes.produce(RouteBuildItem.builder().route(DEFAULT_HEALTH_ENDPOINT.concat("/*")).handler(new NotFoundHandler()).build()); - } - - boolean metricsDisabled = !isMetricsEnabled(); - - if (healthDisabled || metricsDisabled) { + void disableHealthCheckBean(BuildProducer removeBeans, CombinedIndexBuildItem index) { + if (!isHealthEnabled() || !isMetricsEnabled()) { // disables the single check we provide which depends on metrics enabled ClassInfo disabledBean = index.getIndex() .getClassByName(DotName.createSimple(KeycloakReadyHealthCheck.class.getName())); diff --git a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/integration/web/NotFoundHandler.java b/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/integration/web/NotFoundHandler.java deleted file mode 100644 index 660cdc46b9..0000000000 --- a/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/integration/web/NotFoundHandler.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.keycloak.quarkus.runtime.integration.web; - -import io.vertx.core.Handler; -import io.vertx.ext.web.RoutingContext; - -public class NotFoundHandler implements Handler { - - @Override - public void handle(RoutingContext event) { - event.fail(404); - } -}