DBZ-743 Empty password for PostgreSQL and MySQL

This commit is contained in:
Jiri Pechanec 2018-06-25 17:44:23 +02:00 committed by Gunnar Morling
parent 9d05fc2dc5
commit ca6b1c9168
6 changed files with 9 additions and 6 deletions

View File

@ -84,11 +84,14 @@ public Config validate(Map<String, String> connectorConfigs) {
ConfigValue userValue = results.get(MySqlConnectorConfig.USER.name());
ConfigValue passwordValue = results.get(MySqlConnectorConfig.PASSWORD.name());
if (passwordValue.value() == null || ((String)passwordValue.value()).isEmpty()) {
logger.warn("The connection password is empty");
}
// If there are no errors on any of these ...
if (hostnameValue.errorMessages().isEmpty()
&& portValue.errorMessages().isEmpty()
&& userValue.errorMessages().isEmpty()
&& passwordValue.errorMessages().isEmpty()) {
&& userValue.errorMessages().isEmpty()) {
// Try to connect to the database ...
try (MySqlJdbcContext jdbcContext = new MySqlJdbcContext(config)) {
jdbcContext.start();

View File

@ -556,7 +556,6 @@ public static DdlParsingMode parse(String value, String defaultValue) {
.withType(Type.PASSWORD)
.withWidth(Width.SHORT)
.withImportance(Importance.HIGH)
.withValidation(Field::isRequired)
.withDescription("Password of the MySQL database user to be used when connecting to the database.");
public static final Field SERVER_NAME = Field.create("database.server.name")

View File

@ -107,7 +107,6 @@ public void shouldFailToValidateInvalidConfiguration() {
assertConfigurationErrors(result, MySqlConnectorConfig.HOSTNAME, 1);
assertNoConfigurationErrors(result, MySqlConnectorConfig.PORT);
assertConfigurationErrors(result, MySqlConnectorConfig.USER, 1);
assertConfigurationErrors(result, MySqlConnectorConfig.PASSWORD, 1);
assertConfigurationErrors(result, MySqlConnectorConfig.SERVER_NAME, 2);
assertNoConfigurationErrors(result, MySqlConnectorConfig.SERVER_ID);
assertNoConfigurationErrors(result, MySqlConnectorConfig.TABLES_IGNORE_BUILTIN);

View File

@ -85,6 +85,10 @@ public Config validate(Map<String, String> connectorConfigs) {
ConfigValue userValue = results.get(PostgresConnectorConfig.USER.name());
ConfigValue passwordValue = results.get(PostgresConnectorConfig.PASSWORD.name());
if (passwordValue.value() == null || ((String)passwordValue.value()).isEmpty()) {
logger.warn("The connection password is empty");
}
// If there are no errors on any of these ...
if (hostnameValue.errorMessages().isEmpty()
&& portValue.errorMessages().isEmpty()

View File

@ -438,7 +438,6 @@ public String getPostgresPluginName() {
.withType(Type.PASSWORD)
.withWidth(Width.SHORT)
.withImportance(Importance.HIGH)
.withValidation(Field::isRequired)
.withDescription("Password of the Postgres database user to be used when connecting to the database.");
public static final Field DATABASE_NAME = Field.create(DATABASE_CONFIG_PREFIX + JdbcConfiguration.DATABASE)

View File

@ -121,7 +121,6 @@ public void shouldValidateConfiguration() throws Exception {
// validate that the required fields have errors
assertConfigurationErrors(validatedConfig, PostgresConnectorConfig.HOSTNAME, 1);
assertConfigurationErrors(validatedConfig, PostgresConnectorConfig.USER, 1);
assertConfigurationErrors(validatedConfig, PostgresConnectorConfig.PASSWORD, 1);
assertConfigurationErrors(validatedConfig, PostgresConnectorConfig.DATABASE_NAME, 1);
// validate the non required fields