Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-5574. Added new api for get manager, added flap in server configur… #3161

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
47bbbdd
CB-5954. Added new api for get manager, added flap in server configur…
DenisSinelnikov Dec 25, 2024
fb70b44
Merge branch 'devel' into CB-5574-add-aws-secrets-manager-auth-to-sup…
sergeyteleshev Dec 25, 2024
1790f5f
CB-5574 adds secret manager depending on the setting
sergeyteleshev Dec 25, 2024
9c0920d
CB-5574. Fixed save secretManager parameter, update API
DenisSinelnikov Dec 25, 2024
712bc4c
Merge branch 'devel' into CB-5574-add-aws-secrets-manager-auth-to-sup…
sergeyteleshev Dec 26, 2024
6233da7
Merge branch 'devel' into CB-5574-add-aws-secrets-manager-auth-to-sup…
DenisSinelnikov Dec 26, 2024
01c22b4
CB-5574 changes order for secret manager
sergeyteleshev Dec 27, 2024
7f1090a
Merge branch 'devel' into CB-5574-add-aws-secrets-manager-auth-to-sup…
sergeyteleshev Dec 30, 2024
a0ef017
Merge branch 'devel' into CB-5574-add-aws-secrets-manager-auth-to-sup…
sergeyteleshev Dec 30, 2024
d712efa
Merge branch 'devel' into CB-5574-add-aws-secrets-manager-auth-to-sup…
DenisSinelnikov Dec 30, 2024
43fe217
CB-5574. Added/refactor api for datasources
DenisSinelnikov Dec 30, 2024
320958d
Merge remote-tracking branch 'origin/CB-5574-add-aws-secrets-manager-…
DenisSinelnikov Dec 30, 2024
ac3941a
Merge branch 'devel' into CB-5574-add-aws-secrets-manager-auth-to-sup…
sergeyteleshev Dec 30, 2024
db9b61b
CB-5574. Fixed build
DenisSinelnikov Dec 31, 2024
3c5550b
Merge remote-tracking branch 'origin/CB-5574-add-aws-secrets-manager-…
DenisSinelnikov Dec 31, 2024
6349118
CB-5574. Fixed params in datasources
DenisSinelnikov Jan 6, 2025
1911c0a
CB-5574. Update testConnection
DenisSinelnikov Jan 6, 2025
5a0d94c
Merge branch 'devel' into CB-5574-add-aws-secrets-manager-auth-to-sup…
sergeyteleshev Jan 8, 2025
a3c67a4
Merge branch 'devel' into CB-5574-add-aws-secrets-manager-auth-to-sup…
DenisSinelnikov Jan 8, 2025
f8462d1
CB-5574. Refactor after review
DenisSinelnikov Jan 8, 2025
d98bbb6
Merge remote-tracking branch 'origin/CB-5574-add-aws-secrets-manager-…
DenisSinelnikov Jan 8, 2025
8ca60c6
Merge branch 'devel' into CB-5574-add-aws-secrets-manager-auth-to-sup…
sergeyteleshev Jan 9, 2025
800ab35
Merge branch 'devel' into CB-5574-add-aws-secrets-manager-auth-to-sup…
kseniaguzeeva Jan 13, 2025
b12b921
Merge branch 'devel' into CB-5574-add-aws-secrets-manager-auth-to-sup…
sergeyteleshev Jan 13, 2025
ce3a96f
CB-5574 RM EE impl
alexander-skoblikov Jan 14, 2025
742dada
CB-5574. Fixed showing secrets in TE
DenisSinelnikov Jan 14, 2025
0f7e4f4
CB-5574. Added sort for secrets
DenisSinelnikov Jan 15, 2025
e0f4bf0
Merge branch 'devel' into CB-5574-add-aws-secrets-manager-auth-to-sup…
DenisSinelnikov Jan 15, 2025
6ba1a71
CB-5574. Resolve conflicts
DenisSinelnikov Jan 15, 2025
811bb7a
CB-5574. Added none parameter
DenisSinelnikov Jan 15, 2025
11401b4
Merge branch 'devel' into CB-5574-add-aws-secrets-manager-auth-to-sup…
DenisSinelnikov Jan 20, 2025
5113f37
CB-5574. Resolve Conflicts
DenisSinelnikov Jan 20, 2025
7628a10
CB-5574. Refactor after review
DenisSinelnikov Jan 20, 2025
91e1cf4
CB-5574. Refactor after review
DenisSinelnikov Jan 20, 2025
0845f7d
CB-5574. Refactor after review
DenisSinelnikov Jan 20, 2025
053c706
Merge branch 'devel' into CB-5574-add-aws-secrets-manager-auth-to-sup…
kseniaguzeeva Jan 21, 2025
f63dcd2
CB-5574. Fixed update secret management, throw exception if secret ma…
DenisSinelnikov Jan 21, 2025
665a4ac
Merge remote-tracking branch 'origin/CB-5574-add-aws-secrets-manager-…
DenisSinelnikov Jan 21, 2025
b6ba1b6
CB-5574. Refactor after review
DenisSinelnikov Jan 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -44,6 +44,12 @@
private DBPPropertySource propertySource;
private boolean showProtected;

private Object[] validValues;

private String[] supportedConfigurationTypes = new String[0];

private Object defaultValue;

public WebPropertyInfo(WebSession session, DBPPropertyDescriptor property, DBPPropertySource propertySource) {
this.session = session;
this.property = property;
Expand Down Expand Up @@ -123,7 +129,7 @@

@Property
public Object getDefaultValue() throws DBException {
var defaultValue = property.getDefaultValue();
var defaultValue = property.getDefaultValue() == null ? this.defaultValue : property.getDefaultValue();
return defaultValue == null ? getValue() : defaultValue;
}

Expand Down Expand Up @@ -154,9 +160,9 @@
}
return validValues;
}
return null;
return validValues;
}
return null;
return validValues;
}

@Property
Expand All @@ -172,7 +178,7 @@
.map(DBPDriverConfigurationType::toString)
.toArray(String[]::new);
}
return new String[0];
return supportedConfigurationTypes;
}

@Property
Expand Down Expand Up @@ -252,4 +258,20 @@
}
return null;
}

//TODO: delete after refactoring on front-end
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
//TODO: delete after refactoring on front-end
public void setValidValues(Object[] validValues) {

Check warning on line 267 in server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebPropertyInfo.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 'METHOD_DEF' should be separated from previous line. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebPropertyInfo.java:267:5: warning: 'METHOD_DEF' should be separated from previous line. (com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck)

Check warning on line 267 in server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebPropertyInfo.java

View check run for this annotation

Jenkins-CI-integration / CheckStyle Java Report

server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/WebPropertyInfo.java#L267

METHOD_DEF should be separated from previous line.
this.validValues = validValues;
}

//TODO: delete after refactoring on front-end
public void setSupportedConfigurationTypes(String[] supportedConfigurationTypes) {
this.supportedConfigurationTypes = supportedConfigurationTypes;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public abstract class BaseWebAppConfiguration implements ServletAppConfiguration
protected final Map<String, Object> plugins;
protected String defaultUserTeam = DEFAULT_APP_ANONYMOUS_TEAM_NAME;
protected boolean resourceManagerEnabled;
protected boolean secretManagerEnabled;
protected boolean showReadOnlyConnectionInfo;
protected String[] enabledFeatures;
protected String[] disabledBetaFeatures;
Expand All @@ -42,6 +43,7 @@ public BaseWebAppConfiguration() {
this.enabledFeatures = null;
this.disabledBetaFeatures = new String[0];
this.showReadOnlyConnectionInfo = false;
this.secretManagerEnabled = false;
}

public BaseWebAppConfiguration(BaseWebAppConfiguration src) {
Expand All @@ -51,6 +53,7 @@ public BaseWebAppConfiguration(BaseWebAppConfiguration src) {
this.enabledFeatures = src.enabledFeatures;
this.disabledBetaFeatures = src.disabledBetaFeatures;
this.showReadOnlyConnectionInfo = src.showReadOnlyConnectionInfo;
this.secretManagerEnabled = src.secretManagerEnabled;
}

@Override
Expand Down Expand Up @@ -84,6 +87,11 @@ public boolean isResourceManagerEnabled() {
return resourceManagerEnabled;
}

@Override
public boolean isSecretManagerEnabled() {
return secretManagerEnabled;
}

@Override
public boolean isFeatureEnabled(String id) {
return ArrayUtils.contains(getEnabledFeatures(), id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@

Map<String, Object> getPluginConfig(@NotNull String pluginId, boolean create);

boolean isResourceManagerEnabled();

Check warning on line 41 in server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/app/ServletAppConfiguration.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/app/ServletAppConfiguration.java:41:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

boolean isSecretManagerEnabled();

Check warning on line 43 in server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/app/ServletAppConfiguration.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/app/ServletAppConfiguration.java:43:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

Check warning on line 43 in server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/app/ServletAppConfiguration.java

View check run for this annotation

Jenkins-CI-integration / CheckStyle Java Report

server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/app/ServletAppConfiguration.java#L43

Missing a Javadoc comment.

boolean isFeaturesEnabled(String[] requiredFeatures);

Check warning on line 45 in server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/app/ServletAppConfiguration.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/app/ServletAppConfiguration.java:45:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

boolean isFeatureEnabled(String id);

Check warning on line 47 in server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/app/ServletAppConfiguration.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/app/ServletAppConfiguration.java:47:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

@NotNull
default String[] getEnabledFeatures() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ public void setResourceManagerEnabled(boolean resourceManagerEnabled) {
this.resourceManagerEnabled = resourceManagerEnabled;
}

public void setSecretManagerEnabled(boolean secretManagerEnabled) {
this.secretManagerEnabled = secretManagerEnabled;
}

public boolean isSupportsCustomConnections() {
return supportsCustomConnections;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -114,13 +114,22 @@ protected BaseWebProjectImpl getWebProject(String projectId, boolean refresh) th
if (project == null || refresh) {
SessionContextImpl sessionContext = new SessionContextImpl(null);
RMProject rmProject = makeProjectFromId(projectId, false);
project = new InternalWebProjectImpl(sessionContext, rmProject, getProjectPath(projectId));
project = createWebProjectImpl(projectId, sessionContext, rmProject);
projectRegistries.put(projectId, project);
}
return project;
}
}

@NotNull
protected InternalWebProjectImpl createWebProjectImpl(
String projectId,
SessionContextImpl sessionContext,
RMProject rmProject
) throws DBException {
return new InternalWebProjectImpl(sessionContext, rmProject, getProjectPath(projectId));
}

@NotNull
@Override
public RMProject[] listAccessibleProjects() throws DBException {
Expand Down Expand Up @@ -946,16 +955,19 @@ public String ping() {
return "pong (RM)";
}

public static final class Builder {
private final SMCredentialsProvider credentialsProvider;
private final Supplier<SMController> smController;
private final DBPWorkspace workspace;
public static class Builder {
protected final SMCredentialsProvider credentialsProvider;
protected final Supplier<SMController> smController;
protected final DBPWorkspace workspace;

private Path rootPath;
private Path userProjectsPath;
private Path sharedProjectsPath;
protected Path rootPath;
protected Path userProjectsPath;
protected Path sharedProjectsPath;

private Builder(DBPWorkspace workspace, SMCredentialsProvider credentialsProvider, Supplier<SMController> smControllerSupplier) {
protected Builder(
DBPWorkspace workspace, SMCredentialsProvider credentialsProvider,
Supplier<SMController> smControllerSupplier
) {
this.workspace = workspace;
this.credentialsProvider = credentialsProvider;
this.smController = smControllerSupplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class CBConstants {
public static final String PARAM_STATIC_CONTENT = "staticContent";
public static final String PARAM_RESOURCE_QUOTAS = "resourceQuotas";
public static final String PARAM_RESOURCE_MANAGER_ENABLED = "resourceManagerEnabled";
public static final String PARAM_SECRET_MANAGER_ENABLED = "secretManagerEnabled";
public static final String PARAM_SHOW_READ_ONLY_CONN_INFO = "showReadOnlyConnectionInfo";
public static final String PARAM_CONN_GRANT_ANON_ACCESS = "grantConnectionsAccessToAnonymousTeam";
public static final String PARAM_AUTH_PROVIDERS = "authConfiguration";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Export-Package: io.cloudbeaver,
io.cloudbeaver.model.config,
io.cloudbeaver.server,
io.cloudbeaver.service,
io.cloudbeaver.service.core,
io.cloudbeaver.service.session
Import-Package: org.slf4j
Automatic-Module-Name: io.cloudbeaver.server.ce
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import io.cloudbeaver.registry.WebDriverRegistry;
import io.cloudbeaver.registry.WebServiceRegistry;
import io.cloudbeaver.server.jetty.CBJettyServer;
import io.cloudbeaver.service.ConnectionController;
import io.cloudbeaver.service.ConnectionControllerCE;
import io.cloudbeaver.service.DBWServiceInitializer;
import io.cloudbeaver.service.DBWServiceServerConfigurator;
import io.cloudbeaver.service.session.CBSessionManager;
Expand Down Expand Up @@ -773,4 +775,9 @@ public Map<String, String> getInitActions() {
public WebServerConfig getWebServerConfig() {
return new CBWebServerConfig(this);
}

@Override
public ConnectionController getConnectionController() {
return new ConnectionControllerCE();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,11 @@ protected Map<String, Object> collectConfigurationProperties(
appConfigProperties,
CBConstants.PARAM_RESOURCE_MANAGER_ENABLED,
appConfig.isResourceManagerEnabled());
copyConfigValue(
oldAppConfig,
appConfigProperties,
CBConstants.PARAM_SECRET_MANAGER_ENABLED,
appConfig.isSecretManagerEnabled());
copyConfigValue(
oldAppConfig,
appConfigProperties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ type ServerConfig {
supportsCustomConnections: Boolean!
resourceManagerEnabled: Boolean!

secretManagerEnabled: Boolean! @since(version: "24.3.2")

publicCredentialsSaveEnabled: Boolean!
adminCredentialsSaveEnabled: Boolean!

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2025 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -39,6 +39,8 @@
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Stream;

/**
* Web driver configuration
Expand Down Expand Up @@ -255,9 +257,19 @@ public WebPropertyInfo[] getMainProperties() {

@Property
public WebPropertyInfo[] getProviderProperties() {
return Arrays.stream(driver.getProviderPropertyDescriptors())
WebPropertyInfo[] additionalWebProperty = Optional.of(WebAppUtils.getWebApplication())
.filter(app -> app.getAppConfiguration().isSecretManagerEnabled())
.map(app -> app.getConnectionController().getExternalInfo(webSession))
.orElse(new WebPropertyInfo[0]);

WebPropertyInfo[] providerProperties = Arrays.stream(driver.getProviderPropertyDescriptors())
.map(p -> new WebPropertyInfo(webSession, p, null))
.toArray(WebPropertyInfo[]::new);

return Stream.concat(
Arrays.stream(additionalWebProperty),
Arrays.stream(providerProperties)
).toArray(WebPropertyInfo[]::new);
}

@Property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ public boolean isResourceManagerEnabled() {
return application.getAppConfiguration().isResourceManagerEnabled();
}

@Property
public boolean isSecretManagerEnabled() {
return application.getAppConfiguration().isSecretManagerEnabled();
}

@Property
public String[] getEnabledFeatures() {
return application.getAppConfiguration().getEnabledFeatures();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.cloudbeaver.model.app.WebAppConfiguration;
import io.cloudbeaver.model.app.WebServerConfiguration;
import io.cloudbeaver.registry.WebDriverRegistry;
import io.cloudbeaver.service.ConnectionController;
import org.jkiss.code.NotNull;

import java.net.InetAddress;
Expand Down Expand Up @@ -50,6 +51,8 @@

String getLicenseStatus();

WebServerConfig getWebServerConfig();

Check warning on line 54 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/WebApplication.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/WebApplication.java:54:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

ConnectionController getConnectionController();

Check warning on line 56 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/WebApplication.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/WebApplication.java:56:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

Check warning on line 56 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/WebApplication.java

View check run for this annotation

Jenkins-CI-integration / CheckStyle Java Report

server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/WebApplication.java#L56

Missing a Javadoc comment.

}
Loading
Loading