From a099805f42b8f8c95d6e544d485260bec008aa09 Mon Sep 17 00:00:00 2001 From: Sergey Beryozkin Date: Tue, 15 Jun 2021 16:04:28 +0100 Subject: [PATCH] Enable SSL and all security services for smallrye-jwt --- .../jwt/deployment/SmallRyeJwtProcessor.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/extensions/smallrye-jwt/deployment/src/main/java/io/quarkus/smallrye/jwt/deployment/SmallRyeJwtProcessor.java b/extensions/smallrye-jwt/deployment/src/main/java/io/quarkus/smallrye/jwt/deployment/SmallRyeJwtProcessor.java index 94cbc5db38180..a4aeafe88a981 100644 --- a/extensions/smallrye-jwt/deployment/src/main/java/io/quarkus/smallrye/jwt/deployment/SmallRyeJwtProcessor.java +++ b/extensions/smallrye-jwt/deployment/src/main/java/io/quarkus/smallrye/jwt/deployment/SmallRyeJwtProcessor.java @@ -3,6 +3,7 @@ import java.util.HashSet; import java.util.Optional; import java.util.Set; +import java.util.function.BooleanSupplier; import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.config.ConfigProvider; @@ -25,6 +26,8 @@ import io.quarkus.deployment.Feature; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.EnableAllSecurityServicesBuildItem; +import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; @@ -56,6 +59,16 @@ class SmallRyeJwtProcessor { SmallRyeJWTConfig config; + @BuildStep(onlyIf = IsEnabled.class) + ExtensionSslNativeSupportBuildItem enableSslInNative() { + return new ExtensionSslNativeSupportBuildItem(Feature.SMALLRYE_JWT); + } + + @BuildStep(onlyIf = IsEnabled.class) + EnableAllSecurityServicesBuildItem security() { + return new EnableAllSecurityServicesBuildItem(); + } + /** * Register the CDI beans that are needed by the MP-JWT extension * @@ -160,4 +173,12 @@ void registerOptionalClaimProducer(BeanRegistrationPhaseBuildItem beanRegistrati configurator.creator(RawOptionalClaimCreator.class); beanConfigurator.produce(new BeanConfiguratorBuildItem(configurator)); } + + public static class IsEnabled implements BooleanSupplier { + SmallRyeJWTConfig config; + + public boolean getAsBoolean() { + return config.enabled; + } + } }