diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java index 946ba17e73..90b1b50d0f 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java @@ -16,6 +16,7 @@ */ package io.cloudbeaver.server; +import org.jkiss.dbeaver.model.auth.AuthInfo; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.InstanceCreator; @@ -24,7 +25,6 @@ import io.cloudbeaver.model.app.BaseWebApplication; import io.cloudbeaver.model.app.WebAuthApplication; import io.cloudbeaver.model.app.WebAuthConfiguration; -import io.cloudbeaver.model.session.WebAuthInfo; import io.cloudbeaver.registry.WebDriverRegistry; import io.cloudbeaver.registry.WebServiceRegistry; import io.cloudbeaver.server.jetty.CBJettyServer; @@ -825,7 +825,7 @@ public synchronized void finishConfiguration( @NotNull String newServerURL, @NotNull String adminName, @Nullable String adminPassword, - @NotNull List authInfoList, + @NotNull List authInfoList, long sessionExpireTime, @NotNull CBAppConfig appConfig, @Nullable SMCredentialsProvider credentialsProvider @@ -886,7 +886,7 @@ protected Map readRuntimeConfigurationProperties() throws DBExce protected abstract void finishSecurityServiceConfiguration( @NotNull String adminName, @Nullable String adminPassword, - @NotNull List authInfoList + @NotNull List authInfoList ) throws DBException; public synchronized void flushConfiguration(SMCredentialsProvider credentialsProvider) throws DBException { diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplicationCE.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplicationCE.java index 456970f70b..cfb125e488 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplicationCE.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplicationCE.java @@ -16,9 +16,9 @@ */ package io.cloudbeaver.server; +import org.jkiss.dbeaver.model.auth.AuthInfo; import io.cloudbeaver.auth.NoAuthCredentialsProvider; import io.cloudbeaver.model.rm.local.LocalResourceController; -import io.cloudbeaver.model.session.WebAuthInfo; import io.cloudbeaver.service.security.CBEmbeddedSecurityController; import io.cloudbeaver.service.security.EmbeddedSecurityControllerFactory; import org.jkiss.code.NotNull; @@ -31,7 +31,6 @@ import org.jkiss.dbeaver.model.rm.RMController; import org.jkiss.dbeaver.model.security.SMAdminController; import org.jkiss.dbeaver.model.security.SMController; -import org.jkiss.dbeaver.registry.BasePlatformImpl; import org.jkiss.dbeaver.registry.LocalFileController; import org.jkiss.dbeaver.runtime.DBWorkbench; @@ -94,7 +93,7 @@ protected void shutdown() { protected void finishSecurityServiceConfiguration( @NotNull String adminName, @Nullable String adminPassword, - @NotNull List authInfoList + @NotNull List authInfoList ) throws DBException { if (securityController instanceof CBEmbeddedSecurityController) { ((CBEmbeddedSecurityController) securityController).finishConfiguration(adminName, adminPassword, authInfoList); diff --git a/server/bundles/io.cloudbeaver.service.admin/src/io/cloudbeaver/service/admin/impl/WebServiceAdmin.java b/server/bundles/io.cloudbeaver.service.admin/src/io/cloudbeaver/service/admin/impl/WebServiceAdmin.java index 9a903f9364..47df0055d1 100644 --- a/server/bundles/io.cloudbeaver.service.admin/src/io/cloudbeaver/service/admin/impl/WebServiceAdmin.java +++ b/server/bundles/io.cloudbeaver.service.admin/src/io/cloudbeaver/service/admin/impl/WebServiceAdmin.java @@ -40,6 +40,7 @@ import org.jkiss.dbeaver.model.DBPDataSourceContainer; import org.jkiss.dbeaver.model.app.DBPDataSourceRegistry; import org.jkiss.dbeaver.model.app.DBPProject; +import org.jkiss.dbeaver.model.auth.AuthInfo; import org.jkiss.dbeaver.model.navigator.DBNBrowseSettings; import org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor; import org.jkiss.dbeaver.model.security.*; @@ -514,6 +515,7 @@ public boolean configureServer(WebSession webSession, Map params adminName = curUser == null ? null : curUser.getUserId(); adminPassword = null; } + List authInfos = new ArrayList<>(); List authInfoList = webSession.getAllAuthInfo(); if (CommonUtils.isEmpty(adminName)) { // Try to get admin name from existing authentications (first one) @@ -524,6 +526,11 @@ public boolean configureServer(WebSession webSession, Map params if (CommonUtils.isEmpty(adminName)) { adminName = CBConstants.DEFAULT_ADMIN_NAME; } + for (WebAuthInfo webAuthInfo : authInfoList) { + authInfos.add(new AuthInfo( + webAuthInfo.getAuthProviderDescriptor().getId(), + webAuthInfo.getUserCredentials())); + } // Patch configuration by services for (DBWServiceServerConfigurator wsc : WebServiceRegistry.getInstance().getWebServices(DBWServiceServerConfigurator.class)) { @@ -541,7 +548,7 @@ public boolean configureServer(WebSession webSession, Map params serverURL, adminName, adminPassword, - authInfoList, + authInfos, sessionExpireTime, appConfig, webSession diff --git a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/CBEmbeddedSecurityController.java b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/CBEmbeddedSecurityController.java index 0a06993d3d..8c9c332dd1 100644 --- a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/CBEmbeddedSecurityController.java +++ b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/CBEmbeddedSecurityController.java @@ -26,7 +26,6 @@ import io.cloudbeaver.model.app.WebAppConfiguration; import io.cloudbeaver.model.app.WebAuthApplication; import io.cloudbeaver.model.app.WebAuthConfiguration; -import io.cloudbeaver.model.session.WebAuthInfo; import io.cloudbeaver.registry.WebAuthProviderDescriptor; import io.cloudbeaver.registry.WebAuthProviderRegistry; import io.cloudbeaver.registry.WebMetaParametersRegistry; @@ -2625,7 +2624,7 @@ public void shutdown() { public void finishConfiguration( @NotNull String adminName, @Nullable String adminPassword, - @NotNull List authInfoList + @NotNull List authInfoList ) throws DBException { database.finishConfiguration(adminName, adminPassword, authInfoList); } diff --git a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/CBDatabase.java b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/CBDatabase.java index 83607ab788..13475c8960 100644 --- a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/CBDatabase.java +++ b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/CBDatabase.java @@ -20,7 +20,6 @@ import com.google.gson.GsonBuilder; import io.cloudbeaver.auth.provider.local.LocalAuthProviderConstants; import io.cloudbeaver.model.app.WebApplication; -import io.cloudbeaver.model.session.WebAuthInfo; import io.cloudbeaver.registry.WebAuthProviderDescriptor; import io.cloudbeaver.registry.WebAuthProviderRegistry; import io.cloudbeaver.utils.WebAppUtils; @@ -32,6 +31,7 @@ import org.jkiss.dbeaver.DBException; import org.jkiss.dbeaver.Log; import org.jkiss.dbeaver.model.DBConstants; +import org.jkiss.dbeaver.model.auth.AuthInfo; import org.jkiss.dbeaver.model.connection.DBPDriver; import org.jkiss.dbeaver.model.impl.jdbc.JDBCUtils; import org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCTransaction; @@ -246,7 +246,7 @@ protected PoolingDataSource initConnectionPool( public void finishConfiguration( @NotNull String adminName, @Nullable String adminPassword, - @NotNull List authInfoList + @NotNull List authInfoList ) throws DBException { if (!application.isConfigurationMode()) { throw new DBException("Database is already configured"); @@ -264,12 +264,11 @@ public void finishConfiguration( createAdminUser(adminName, adminPassword); // Associate all auth credentials with admin user - for (WebAuthInfo ai : authInfoList) { + for (AuthInfo ai : authInfoList) { if (!ai.getAuthProvider().equals(LocalAuthProviderConstants.PROVIDER_ID)) { - WebAuthProviderDescriptor authProvider = ai.getAuthProviderDescriptor(); Map userCredentials = ai.getUserCredentials(); if (!CommonUtils.isEmpty(userCredentials)) { - adminSecurityController.setUserCredentials(adminName, authProvider.getId(), userCredentials); + adminSecurityController.setUserCredentials(adminName, ai.getAuthProvider(), userCredentials); } } } diff --git a/webapp/packages/core-resource/src/Resource/Resource.ts b/webapp/packages/core-resource/src/Resource/Resource.ts index 12cc9a18f6..40357c32a5 100644 --- a/webapp/packages/core-resource/src/Resource/Resource.ts +++ b/webapp/packages/core-resource/src/Resource/Resource.ts @@ -122,6 +122,10 @@ export abstract class Resource< getException(param: ResourceKeyList): Error[] | null; getException(param: ResourceKey): Error[] | Error | null; getException(param: ResourceKey): Error[] | Error | null { + if (param === undefined) { + param = CachedResourceParamKey; + } + if (isResourceKeyList(param)) { return this.metadata.map(param, metadata => metadata?.exception || null).filter((exception): exception is Error => exception !== null); }