Skip to content

Commit

Permalink
Make sure OIDC is set up after CP
Browse files Browse the repository at this point in the history
It uses Mutiny, which requires CP to be initialised
  • Loading branch information
FroMage committed Apr 9, 2024
1 parent eb6b1ff commit ad06f24
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import io.quarkus.oidc.runtime.TenantConfigBean;
import io.quarkus.oidc.runtime.providers.AzureAccessTokenCustomizer;
import io.quarkus.runtime.TlsConfig;
import io.quarkus.smallrye.context.deployment.ContextPropagationInitializedBuildItem;
import io.quarkus.vertx.core.deployment.CoreVertxBuildItem;
import io.quarkus.vertx.http.deployment.EagerSecurityInterceptorBindingBuildItem;
import io.quarkus.vertx.http.deployment.HttpAuthMechanismAnnotationBuildItem;
Expand Down Expand Up @@ -220,7 +221,9 @@ public SyntheticBeanBuildItem setup(
OidcConfig config,
OidcRecorder recorder,
CoreVertxBuildItem vertxBuildItem,
TlsConfig tlsConfig) {
TlsConfig tlsConfig,
// this is required for setup ordering: we need CP set up
ContextPropagationInitializedBuildItem cpInitializedBuildItem) {
return SyntheticBeanBuildItem.configure(TenantConfigBean.class).unremovable().types(TenantConfigBean.class)
.supplier(recorder.setup(config, vertxBuildItem.getVertx(), tlsConfig))
.destroyer(TenantConfigBean.Destroyer.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.quarkus.smallrye.context.deployment;

import io.quarkus.builder.item.SimpleBuildItem;

/**
* Marker build item for build ordering. Signifies that CP is set up
* and ready for use.
*/
public final class ContextPropagationInitializedBuildItem extends SimpleBuildItem {

}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ void buildStatic(SmallRyeContextPropagationRecorder recorder, List<ThreadContext
void build(SmallRyeContextPropagationRecorder recorder,
ExecutorBuildItem executorBuildItem,
ShutdownContextBuildItem shutdownContextBuildItem,
BuildProducer<ContextPropagationInitializedBuildItem> cpInitializedBuildItem,
BuildProducer<FeatureBuildItem> feature,
BuildProducer<SyntheticBeanBuildItem> syntheticBeans) {
feature.produce(new FeatureBuildItem(Feature.SMALLRYE_CONTEXT_PROPAGATION));
Expand All @@ -111,6 +112,8 @@ void build(SmallRyeContextPropagationRecorder recorder,
.unremovable()
.supplier(recorder.initializeManagedExecutor(executorBuildItem.getExecutorProxy()))
.setRuntimeInit().done());

cpInitializedBuildItem.produce(new ContextPropagationInitializedBuildItem());
}

// transform IPs for ManagedExecutor/ThreadContext that use config annotation and don't yet have @NamedInstance
Expand Down

0 comments on commit ad06f24

Please sign in to comment.