From df21e1639db6788bbc6b943c5d19fad621eb67d5 Mon Sep 17 00:00:00 2001 From: Martin Kouba Date: Wed, 22 Jun 2022 16:45:44 +0200 Subject: [PATCH] Fix OidcBuildStep#findSecurityEventObservers() - this build step should consume RuntimeConfigSetupCompleteBuildItem because DefaultTenantConfigResolver injects a runtime config property - resolves #26236 --- .../quarkus/oidc/deployment/OidcBuildStep.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/OidcBuildStep.java b/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/OidcBuildStep.java index 38dc9944289887..b2d423cb063314 100644 --- a/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/OidcBuildStep.java +++ b/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/OidcBuildStep.java @@ -1,6 +1,5 @@ package io.quarkus.oidc.deployment; -import java.util.Collection; import java.util.function.BooleanSupplier; import javax.inject.Singleton; @@ -9,11 +8,8 @@ import org.jboss.jandex.DotName; import io.quarkus.arc.deployment.AdditionalBeanBuildItem; +import io.quarkus.arc.deployment.SynthesisFinishedBuildItem; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; -import io.quarkus.arc.deployment.ValidationPhaseBuildItem; -import io.quarkus.arc.deployment.ValidationPhaseBuildItem.ValidationErrorBuildItem; -import io.quarkus.arc.processor.BuildExtension; -import io.quarkus.arc.processor.ObserverInfo; import io.quarkus.deployment.Capabilities; import io.quarkus.deployment.Capability; import io.quarkus.deployment.Feature; @@ -23,6 +19,7 @@ import io.quarkus.deployment.annotations.Record; import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; +import io.quarkus.deployment.builditem.RuntimeConfigSetupCompleteBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.oidc.SecurityEvent; import io.quarkus.oidc.TokenIntrospectionCache; @@ -130,14 +127,14 @@ public SyntheticBeanBuildItem setup( @BuildStep(onlyIf = IsEnabled.class) @Record(ExecutionTime.RUNTIME_INIT) - public ValidationErrorBuildItem findSecurityEventObservers( + public void findSecurityEventObservers( OidcRecorder recorder, - ValidationPhaseBuildItem validationPhase) { - Collection observers = validationPhase.getContext().get(BuildExtension.Key.OBSERVERS); - boolean isSecurityEventObserved = observers.stream() + SynthesisFinishedBuildItem synthesisFinished, + // Note that DefaultTenantConfigResolver injects quarkus.http.proxy.enable-forwarded-prefix + RuntimeConfigSetupCompleteBuildItem runtimeConfigComplete) { + boolean isSecurityEventObserved = synthesisFinished.getObservers().stream() .anyMatch(observer -> observer.asObserver().getObservedType().name().equals(DOTNAME_SECURITY_EVENT)); recorder.setSecurityEventObserved(isSecurityEventObserved); - return new ValidationErrorBuildItem(); } public static class IsEnabled implements BooleanSupplier {