From 160e95b2a554eaa677948a15a5b99971f7ab7628 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Sat, 20 Jul 2024 13:46:07 +0200 Subject: [PATCH] Avoid mixing @ConfigMapping and legacy @ConfigRoot in OIDC token propagation This is going to be a problem with the new extension annotation processor. --- .../OidcTokenPropagationBuildStep.java | 4 ++-- .../OidcTokenPropagationBuildTimeConfig.java | 18 +++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/extensions/oidc-token-propagation/deployment/src/main/java/io/quarkus/oidc/token/propagation/deployment/OidcTokenPropagationBuildStep.java b/extensions/oidc-token-propagation/deployment/src/main/java/io/quarkus/oidc/token/propagation/deployment/OidcTokenPropagationBuildStep.java index 1341908114d33..79350925a8d9a 100644 --- a/extensions/oidc-token-propagation/deployment/src/main/java/io/quarkus/oidc/token/propagation/deployment/OidcTokenPropagationBuildStep.java +++ b/extensions/oidc-token-propagation/deployment/src/main/java/io/quarkus/oidc/token/propagation/deployment/OidcTokenPropagationBuildStep.java @@ -92,7 +92,7 @@ public static class IsEnabled implements BooleanSupplier { OidcTokenPropagationBuildTimeConfig config; public boolean getAsBoolean() { - return config.enabled; + return config.enabled(); } } @@ -100,7 +100,7 @@ public static class IsEnabledDuringAuth implements BooleanSupplier { OidcTokenPropagationBuildTimeConfig config; public boolean getAsBoolean() { - return config.enabledDuringAuthentication; + return config.enabledDuringAuthentication(); } } } diff --git a/extensions/oidc-token-propagation/runtime/src/main/java/io/quarkus/oidc/token/propagation/runtime/OidcTokenPropagationBuildTimeConfig.java b/extensions/oidc-token-propagation/runtime/src/main/java/io/quarkus/oidc/token/propagation/runtime/OidcTokenPropagationBuildTimeConfig.java index d185cde4876fa..68bb0b4fff453 100644 --- a/extensions/oidc-token-propagation/runtime/src/main/java/io/quarkus/oidc/token/propagation/runtime/OidcTokenPropagationBuildTimeConfig.java +++ b/extensions/oidc-token-propagation/runtime/src/main/java/io/quarkus/oidc/token/propagation/runtime/OidcTokenPropagationBuildTimeConfig.java @@ -1,18 +1,22 @@ package io.quarkus.oidc.token.propagation.runtime; -import io.quarkus.runtime.annotations.ConfigItem; +import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; +import io.smallrye.config.ConfigMapping; +import io.smallrye.config.WithDefault; /** * Build time configuration for OIDC Token Propagation. */ -@ConfigRoot(name = "resteasy-client-oidc-token-propagation") -public class OidcTokenPropagationBuildTimeConfig { +@ConfigMapping(prefix = "quarkus.resteasy-client-oidc-token-propagation") +@ConfigRoot(phase = ConfigPhase.BUILD_TIME) +public interface OidcTokenPropagationBuildTimeConfig { + /** * If the OIDC Token Propagation is enabled. */ - @ConfigItem(defaultValue = "true") - public boolean enabled; + @WithDefault("true") + boolean enabled(); /** * Whether the token propagation is enabled during the `SecurityIdentity` augmentation. @@ -25,6 +29,6 @@ public class OidcTokenPropagationBuildTimeConfig { * * @asciidoclet */ - @ConfigItem(defaultValue = "false") - public boolean enabledDuringAuthentication; + @WithDefault("false") + boolean enabledDuringAuthentication(); }