From 3b1a63570239097a667d1b12166d57cc69d8eb74 Mon Sep 17 00:00:00 2001 From: Sergey Beryozkin Date: Tue, 7 Dec 2021 11:15:49 +0000 Subject: [PATCH] OidcProviderClient has to be closed only when getting the JWK set failed --- .../java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java | 2 -- .../src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java index 051fdbe3a8607..2d4cf94ef6215 100644 --- a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java +++ b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java @@ -1,7 +1,6 @@ package io.quarkus.oidc.client.runtime; import java.io.IOException; -import java.time.Duration; import java.util.HashMap; import java.util.Map; import java.util.function.BiFunction; @@ -34,7 +33,6 @@ public class OidcClientRecorder { private static final Logger LOG = Logger.getLogger(OidcClientRecorder.class); private static final String DEFAULT_OIDC_CLIENT_ID = "Default"; - private static final Duration CONNECTION_BACKOFF_DURATION = Duration.ofSeconds(2); public OidcClients setup(OidcClientsConfig oidcClientsConfig, TlsConfig tlsConfig, Supplier vertx) { 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 502554a93fc34..5f6fbcccc38a9 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 @@ -259,6 +259,7 @@ protected static Uni getJsonWebSetUni(OidcProviderClient client, .expireIn(connectionDelayInMillisecs) .onFailure() .transform(t -> toOidcException(t, oidcConfig.authServerUrl.get())) + .onFailure() .invoke(client::close); } else { return client.getJsonWebKeySet();