From a29d3b4e0cdb4160c410606c9b219e490b3b92ac Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Wed, 12 Apr 2023 10:04:57 +0300 Subject: [PATCH] Remove lambdas from OidcRecorder --- .../io/quarkus/oidc/runtime/OidcRecorder.java | 37 ++++++++++++++++--- 1 file changed, 31 insertions(+), 6 deletions(-) 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 f35e423cba83b..64187c10e2cef 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 @@ -33,6 +33,7 @@ import io.smallrye.jwt.util.KeyUtils; import io.smallrye.mutiny.Uni; import io.vertx.core.Vertx; +import io.vertx.core.json.JsonObject; import io.vertx.core.net.ProxyOptions; import io.vertx.ext.web.client.WebClientOptions; import io.vertx.mutiny.ext.web.client.WebClient; @@ -45,7 +46,12 @@ public class OidcRecorder { private static final Map dynamicTenantsConfig = new ConcurrentHashMap<>(); public Supplier setupTokenCache(OidcConfig config, Supplier vertx) { - return () -> new DefaultTokenIntrospectionUserInfoCache(config, vertx.get()); + return new Supplier() { + @Override + public DefaultTokenIntrospectionUserInfoCache get() { + return new DefaultTokenIntrospectionUserInfoCache(config, vertx.get()); + } + }; } public Supplier setup(OidcConfig config, Supplier vertx, TlsConfig tlsConfig) { @@ -86,7 +92,12 @@ private Uni createDynamicTenantContext(Vertx vertx, } if (!dynamicTenantsConfig.containsKey(tenantId)) { Uni uniContext = createTenantContext(vertx, oidcConfig, tlsConfig, tenantId); - uniContext.onFailure().transform(t -> logTenantConfigContextFailure(t, tenantId)); + uniContext.onFailure().transform(new Function() { + @Override + public Throwable apply(Throwable t) { + return logTenantConfigContextFailure(t, tenantId); + } + }); return uniContext.onItem().transform( new Function() { @Override @@ -232,7 +243,12 @@ private Uni createTenantContext(Vertx vertx, OidcTenantConf } return createOidcProvider(oidcConfig, tlsConfig, vertx) - .onItem().transform(p -> new TenantConfigContext(p, oidcConfig)); + .onItem().transform(new Function() { + @Override + public TenantConfigContext apply(OidcProvider p) { + return new TenantConfigContext(p, oidcConfig); + } + }); } private static TenantConfigContext createTenantContextFromPublicKey(OidcTenantConfig oidcConfig) { @@ -324,7 +340,12 @@ protected static Uni getJsonWebSetUni(OidcProviderClient client, .withBackOff(OidcCommonUtils.CONNECTION_BACKOFF_DURATION, OidcCommonUtils.CONNECTION_BACKOFF_DURATION) .expireIn(connectionDelayInMillisecs) .onFailure() - .transform(t -> toOidcException(t, oidcConfig.authServerUrl.get())) + .transform(new Function() { + @Override + public Throwable apply(Throwable t) { + return toOidcException(t, oidcConfig.authServerUrl.get()); + } + }) .onFailure() .invoke(client::close); } else { @@ -350,8 +371,12 @@ protected static Uni createOidcClientUni(OidcTenantConfig oi final long connectionDelayInMillisecs = OidcCommonUtils.getConnectionDelayInMillis(oidcConfig); metadataUni = OidcCommonUtils.discoverMetadata(client, authServerUriString, connectionDelayInMillisecs) .onItem() - .transform( - json -> new OidcConfigurationMetadata(json, createLocalMetadata(oidcConfig, authServerUriString))); + .transform(new Function() { + @Override + public OidcConfigurationMetadata apply(JsonObject json) { + return new OidcConfigurationMetadata(json, createLocalMetadata(oidcConfig, authServerUriString)); + } + }); } return metadataUni.onItemOrFailure() .transformToUni(new BiFunction>() {