mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
dbeaver/pro#5562 revert hide password if not applicable (#4225)
This commit is contained in:
+2
-13
@@ -20,10 +20,7 @@ import io.cloudbeaver.DBWebException;
|
||||
import io.cloudbeaver.WebServiceUtils;
|
||||
import io.cloudbeaver.model.session.WebSession;
|
||||
import io.cloudbeaver.utils.WebCommonUtils;
|
||||
import org.jkiss.code.NotNull;
|
||||
import org.jkiss.dbeaver.model.DBConstants;
|
||||
import org.jkiss.dbeaver.model.connection.DBPAuthModelDescriptor;
|
||||
import org.jkiss.dbeaver.model.impl.auth.AuthModelDatabaseNative;
|
||||
import org.jkiss.dbeaver.model.meta.Property;
|
||||
import org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor;
|
||||
import org.jkiss.dbeaver.model.preferences.DBPPropertySource;
|
||||
@@ -77,6 +74,7 @@ public class WebDatabaseAuthModel {
|
||||
|
||||
@Property
|
||||
public WebPropertyInfo[] getProperties() throws DBWebException {
|
||||
|
||||
DBPPropertySource credentialsSource = model.createCredentialsSource(null, null);
|
||||
Predicate<DBPPropertyDescriptor> predicate = CommonUtils.isEmpty(getRequiredAuth())
|
||||
? p -> true
|
||||
@@ -84,18 +82,9 @@ public class WebDatabaseAuthModel {
|
||||
|
||||
return Arrays.stream(credentialsSource.getProperties())
|
||||
.filter(predicate)
|
||||
.filter(p -> !isPassword(p) || isPasswordApplicable())
|
||||
.filter(p -> !p.isDesktop())
|
||||
.map(p -> new WebPropertyInfo(webSession, p, credentialsSource))
|
||||
.toArray(WebPropertyInfo[]::new);
|
||||
.map(p -> new WebPropertyInfo(webSession, p, credentialsSource)).toArray(WebPropertyInfo[]::new);
|
||||
}
|
||||
|
||||
private boolean isPassword(@NotNull DBPPropertyDescriptor property) {
|
||||
return property.hasFeature(DBConstants.PROP_FEATURE_PASSWORD);
|
||||
}
|
||||
|
||||
private boolean isPasswordApplicable() {
|
||||
return model.getInstance() instanceof AuthModelDatabaseNative<?> nativeModel &&
|
||||
nativeModel.isUserPasswordApplicable();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user