mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-3098 filter auth model properties fix (#1873)
* CB-3098 filter auth model properties fix * CB-3098 do not fill session credentials in connection info * CB-3098 default value fix --------- Co-authored-by: EvgeniaBzzz <139753579+EvgeniaBzzz@users.noreply.github.com>
This commit is contained in:
@@ -322,9 +322,8 @@ public class WebConnectionInfo {
|
||||
return new WebPropertyInfo[0];
|
||||
}
|
||||
|
||||
// Fill session and user provided credentials
|
||||
// Fill user provided credentials
|
||||
DBPConnectionConfiguration configWithAuth = new DBPConnectionConfiguration(dataSourceContainer.getConnectionConfiguration());
|
||||
session.provideAuthParameters(session.getProgressMonitor(), dataSourceContainer, configWithAuth);
|
||||
|
||||
// show all properties if it is a manual connection
|
||||
Predicate<DBPPropertyDescriptor> predicate = CommonUtils.isEmpty(getRequiredAuth())
|
||||
|
||||
@@ -116,7 +116,8 @@ public class WebPropertyInfo {
|
||||
|
||||
@Property
|
||||
public Object getDefaultValue() throws DBException {
|
||||
return property.getDefaultValue();
|
||||
var defaultValue = property.getDefaultValue();
|
||||
return defaultValue == null ? getValue() : defaultValue;
|
||||
}
|
||||
|
||||
@Property
|
||||
|
||||
+8
-1
@@ -19,12 +19,15 @@ package io.cloudbeaver.model;
|
||||
import io.cloudbeaver.DBWebException;
|
||||
import io.cloudbeaver.WebServiceUtils;
|
||||
import io.cloudbeaver.model.session.WebSession;
|
||||
import io.cloudbeaver.utils.WebCommonUtils;
|
||||
import org.jkiss.dbeaver.model.connection.DBPAuthModelDescriptor;
|
||||
import org.jkiss.dbeaver.model.meta.Property;
|
||||
import org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor;
|
||||
import org.jkiss.dbeaver.model.preferences.DBPPropertySource;
|
||||
import org.jkiss.utils.CommonUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* WebDatabaseAuthModel
|
||||
@@ -73,8 +76,12 @@ public class WebDatabaseAuthModel {
|
||||
public WebPropertyInfo[] getProperties() throws DBWebException {
|
||||
|
||||
DBPPropertySource credentialsSource = model.createCredentialsSource(null, null);
|
||||
Predicate<DBPPropertyDescriptor> predicate = CommonUtils.isEmpty(getRequiredAuth())
|
||||
? p -> true
|
||||
: p -> WebCommonUtils.isAuthPropertyApplicable(p, webSession.getContextCredentialsProviders());
|
||||
|
||||
return Arrays.stream(credentialsSource.getProperties())
|
||||
.filter(p -> WebServiceUtils.isAuthPropertyApplicable(p, webSession.getContextCredentialsProviders()))
|
||||
.filter(predicate)
|
||||
.map(p -> new WebPropertyInfo(webSession, p, credentialsSource)).toArray(WebPropertyInfo[]::new);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user