From 8811efcc31e1479dec291822da5a7829e2f83e26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Vav=C5=99=C3=ADk?= Date: Sat, 16 Dec 2023 12:39:49 +0100 Subject: [PATCH] Fire OIDC event when server not available --- docs/src/main/asciidoc/security-customization.adoc | 2 +- .../src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/src/main/asciidoc/security-customization.adoc b/docs/src/main/asciidoc/security-customization.adoc index da22ad2849803..f6f60fbdf4292 100644 --- a/docs/src/main/asciidoc/security-customization.adoc +++ b/docs/src/main/asciidoc/security-customization.adoc @@ -669,7 +669,7 @@ public class SecurityEventObserver { void observeAuthorizationSuccess(@ObservesAsync AuthorizationSuccessEvent event) { String principalName = getPrincipalName(event); if (principalName != null) { - LOG.debugf("User '%s' has been authorized successfully", event.getSecurityIdentity().getPrincipal().getName()); + LOG.debugf("User '%s' has been authorized successfully", principalName); } } diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java index 4ba2c36c43cb8..b0fe493be4f05 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java @@ -495,12 +495,11 @@ public OidcConfigurationMetadata apply(JsonObject json) { @Override public Uni apply(OidcConfigurationMetadata metadata, Throwable t) { + String tenantId = oidcConfig.tenantId.orElse(DEFAULT_TENANT_ID); if (t != null) { client.close(); - return Uni.createFrom().failure( - toOidcException(t, authServerUriString, oidcConfig.tenantId.orElse(DEFAULT_TENANT_ID))); + return Uni.createFrom().failure(toOidcException(t, authServerUriString, tenantId)); } - String tenantId = oidcConfig.tenantId.orElse(DEFAULT_TENANT_ID); if (shouldFireOidcServerAvailableEvent(tenantId)) { fireOidcServerAvailableEvent(authServerUriString, tenantId); }