Skip to content

Commit

Permalink
Fix OIDC Security event fired before runtime config ready in ARc
Browse files Browse the repository at this point in the history
  • Loading branch information
michalvavrik committed Dec 18, 2023
1 parent d190632 commit 92d0dc5
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.function.Function;
import java.util.function.Supplier;

import org.eclipse.microprofile.config.ConfigProvider;
import org.jboss.logging.Logger;
import org.jose4j.jwk.JsonWebKey;
import org.jose4j.jwk.PublicJsonWebKey;
Expand Down Expand Up @@ -46,7 +47,6 @@
import io.quarkus.security.identity.AuthenticationRequestContext;
import io.quarkus.security.identity.SecurityIdentity;
import io.quarkus.security.identity.request.TokenAuthenticationRequest;
import io.quarkus.security.runtime.SecurityConfig;
import io.quarkus.security.spi.runtime.BlockingSecurityExecutor;
import io.quarkus.security.spi.runtime.MethodDescription;
import io.quarkus.security.spi.runtime.SecurityEventHelper;
Expand Down Expand Up @@ -559,7 +559,7 @@ private static boolean shouldFireOidcServerAvailableEvent(String tenantId) {
}

private static boolean fireOidcServerEvent(String authServerUrl, SecurityEvent.Type eventType) {
if (Arc.container().instance(SecurityConfig.class).get().events().enabled()) {
if (ConfigProvider.getConfig().getOptionalValue("quarkus.security.events.enabled", boolean.class).orElse(true)) {
SecurityEventHelper.fire(
Arc.container().beanManager().getEvent().select(SecurityEvent.class),
new SecurityEvent(eventType, Map.of(AUTH_SERVER_URL, authServerUrl)));
Expand Down

0 comments on commit 92d0dc5

Please sign in to comment.