From abe772a8499e2dac703299dc7045ad3fade45501 Mon Sep 17 00:00:00 2001 From: Nikita Makarov Date: Mon, 13 Dec 2021 13:08:41 +0300 Subject: [PATCH] CB-1467 fix: manually serialize authConfiguration in ConfigurationUtils. --- .../server/ConfigurationUtils.java | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/ConfigurationUtils.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/ConfigurationUtils.java index 2396d05744..d890b7abf6 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/ConfigurationUtils.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/ConfigurationUtils.java @@ -48,7 +48,7 @@ public class ConfigurationUtils { res.put(CBConstants.PARAM_RESOURCE_QUOTAS, resourceQuotas); } - Map authProviders = appConfig.getAuthProviderConfigurations(); + Map authProviders = authConfigToMap(appConfig); if (!CommonUtils.isEmpty(authProviders)) { res.put(CBConstants.PARAM_AUTH_PROVIDERS, authProviders); } @@ -74,6 +74,47 @@ public class ConfigurationUtils { return res; } + public static Map authConfigToMap(@Nullable CBAppConfig appConfig) { + Map res = new LinkedHashMap<>(); + if (appConfig == null) { + return res; + } + + Map authProviders = appConfig.getAuthProviderConfigurations(); + if (!CommonUtils.isEmpty(authProviders)) { + authProviders.forEach((key, value) -> { + Map authProviderConfig = new LinkedHashMap<>(); + authProviderConfig.computeIfAbsent( + "provider", + ignored -> value.getProvider() + ); + authProviderConfig.computeIfAbsent( + "displayName", + ignored -> value.getDisplayName() + ); + authProviderConfig.put( + "disabled", + value.isDisabled() + ); + authProviderConfig.computeIfAbsent( + "iconURL", + ignored -> value.getIconURL() + ); + authProviderConfig.computeIfAbsent( + "description", + ignored -> value.getDescription() + ); + authProviderConfig.computeIfAbsent( + "parameters", + ignored -> value.getParameters() + ); + res.put(key, authProviderConfig); + }); + } + + return res; + } + public static Map defaultNavigatorSettingsConfigToMap(@Nullable DBNBrowseSettings navSettings) { Map res = new LinkedHashMap<>(); if (navSettings == null) {