Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable SSL and all security services for smallrye-jwt #17929

Merged
merged 1 commit into from
Jun 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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;
}
}
}