DBZ-743 Empty password for PostgreSQL and MySQL
This commit is contained in:
parent
9d05fc2dc5
commit
ca6b1c9168
@ -84,11 +84,14 @@ public Config validate(Map<String, String> connectorConfigs) {
|
|||||||
ConfigValue userValue = results.get(MySqlConnectorConfig.USER.name());
|
ConfigValue userValue = results.get(MySqlConnectorConfig.USER.name());
|
||||||
ConfigValue passwordValue = results.get(MySqlConnectorConfig.PASSWORD.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 there are no errors on any of these ...
|
||||||
if (hostnameValue.errorMessages().isEmpty()
|
if (hostnameValue.errorMessages().isEmpty()
|
||||||
&& portValue.errorMessages().isEmpty()
|
&& portValue.errorMessages().isEmpty()
|
||||||
&& userValue.errorMessages().isEmpty()
|
&& userValue.errorMessages().isEmpty()) {
|
||||||
&& passwordValue.errorMessages().isEmpty()) {
|
|
||||||
// Try to connect to the database ...
|
// Try to connect to the database ...
|
||||||
try (MySqlJdbcContext jdbcContext = new MySqlJdbcContext(config)) {
|
try (MySqlJdbcContext jdbcContext = new MySqlJdbcContext(config)) {
|
||||||
jdbcContext.start();
|
jdbcContext.start();
|
||||||
|
@ -556,7 +556,6 @@ public static DdlParsingMode parse(String value, String defaultValue) {
|
|||||||
.withType(Type.PASSWORD)
|
.withType(Type.PASSWORD)
|
||||||
.withWidth(Width.SHORT)
|
.withWidth(Width.SHORT)
|
||||||
.withImportance(Importance.HIGH)
|
.withImportance(Importance.HIGH)
|
||||||
.withValidation(Field::isRequired)
|
|
||||||
.withDescription("Password of the MySQL database user to be used when connecting to the database.");
|
.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")
|
public static final Field SERVER_NAME = Field.create("database.server.name")
|
||||||
|
@ -107,7 +107,6 @@ public void shouldFailToValidateInvalidConfiguration() {
|
|||||||
assertConfigurationErrors(result, MySqlConnectorConfig.HOSTNAME, 1);
|
assertConfigurationErrors(result, MySqlConnectorConfig.HOSTNAME, 1);
|
||||||
assertNoConfigurationErrors(result, MySqlConnectorConfig.PORT);
|
assertNoConfigurationErrors(result, MySqlConnectorConfig.PORT);
|
||||||
assertConfigurationErrors(result, MySqlConnectorConfig.USER, 1);
|
assertConfigurationErrors(result, MySqlConnectorConfig.USER, 1);
|
||||||
assertConfigurationErrors(result, MySqlConnectorConfig.PASSWORD, 1);
|
|
||||||
assertConfigurationErrors(result, MySqlConnectorConfig.SERVER_NAME, 2);
|
assertConfigurationErrors(result, MySqlConnectorConfig.SERVER_NAME, 2);
|
||||||
assertNoConfigurationErrors(result, MySqlConnectorConfig.SERVER_ID);
|
assertNoConfigurationErrors(result, MySqlConnectorConfig.SERVER_ID);
|
||||||
assertNoConfigurationErrors(result, MySqlConnectorConfig.TABLES_IGNORE_BUILTIN);
|
assertNoConfigurationErrors(result, MySqlConnectorConfig.TABLES_IGNORE_BUILTIN);
|
||||||
|
@ -85,6 +85,10 @@ public Config validate(Map<String, String> connectorConfigs) {
|
|||||||
ConfigValue userValue = results.get(PostgresConnectorConfig.USER.name());
|
ConfigValue userValue = results.get(PostgresConnectorConfig.USER.name());
|
||||||
ConfigValue passwordValue = results.get(PostgresConnectorConfig.PASSWORD.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 there are no errors on any of these ...
|
||||||
if (hostnameValue.errorMessages().isEmpty()
|
if (hostnameValue.errorMessages().isEmpty()
|
||||||
&& portValue.errorMessages().isEmpty()
|
&& portValue.errorMessages().isEmpty()
|
||||||
|
@ -438,7 +438,6 @@ public String getPostgresPluginName() {
|
|||||||
.withType(Type.PASSWORD)
|
.withType(Type.PASSWORD)
|
||||||
.withWidth(Width.SHORT)
|
.withWidth(Width.SHORT)
|
||||||
.withImportance(Importance.HIGH)
|
.withImportance(Importance.HIGH)
|
||||||
.withValidation(Field::isRequired)
|
|
||||||
.withDescription("Password of the Postgres database user to be used when connecting to the database.");
|
.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)
|
public static final Field DATABASE_NAME = Field.create(DATABASE_CONFIG_PREFIX + JdbcConfiguration.DATABASE)
|
||||||
|
@ -121,7 +121,6 @@ public void shouldValidateConfiguration() throws Exception {
|
|||||||
// validate that the required fields have errors
|
// validate that the required fields have errors
|
||||||
assertConfigurationErrors(validatedConfig, PostgresConnectorConfig.HOSTNAME, 1);
|
assertConfigurationErrors(validatedConfig, PostgresConnectorConfig.HOSTNAME, 1);
|
||||||
assertConfigurationErrors(validatedConfig, PostgresConnectorConfig.USER, 1);
|
assertConfigurationErrors(validatedConfig, PostgresConnectorConfig.USER, 1);
|
||||||
assertConfigurationErrors(validatedConfig, PostgresConnectorConfig.PASSWORD, 1);
|
|
||||||
assertConfigurationErrors(validatedConfig, PostgresConnectorConfig.DATABASE_NAME, 1);
|
assertConfigurationErrors(validatedConfig, PostgresConnectorConfig.DATABASE_NAME, 1);
|
||||||
|
|
||||||
// validate the non required fields
|
// validate the non required fields
|
||||||
|
Loading…
Reference in New Issue
Block a user