GUACAMOLE-641: Standardize database username/password retrieval via JDBCEnvironment.

This commit is contained in:
Michael Jumper
2020-08-25 16:30:42 -07:00
parent 4d65105695
commit c54f126824
7 changed files with 47 additions and 81 deletions

View File

@@ -72,8 +72,8 @@ public class MySQLAuthenticationProviderModule implements Module {
myBatisProperties.setProperty("JDBC.host", environment.getMySQLHostname());
myBatisProperties.setProperty("JDBC.port", String.valueOf(environment.getMySQLPort()));
myBatisProperties.setProperty("JDBC.schema", environment.getMySQLDatabase());
myBatisProperties.setProperty("JDBC.username", environment.getMySQLUsername());
myBatisProperties.setProperty("JDBC.password", environment.getMySQLPassword());
myBatisProperties.setProperty("JDBC.username", environment.getUsername());
myBatisProperties.setProperty("JDBC.password", environment.getPassword());
myBatisProperties.setProperty("JDBC.autoCommit", "false");
myBatisProperties.setProperty("mybatis.pooled.pingEnabled", "true");
myBatisProperties.setProperty("mybatis.pooled.pingQuery", "SELECT 1");

View File

@@ -241,34 +241,14 @@ public class MySQLEnvironment extends JDBCEnvironment {
public String getMySQLDatabase() throws GuacamoleException {
return getRequiredProperty(MySQLGuacamoleProperties.MYSQL_DATABASE);
}
/**
* Returns the username that should be used when authenticating with the
* MySQL database containing the Guacamole authentication tables.
*
* @return
* The username for the MySQL database.
*
* @throws GuacamoleException
* If an error occurs while retrieving the property value, or if the
* value was not set, as this property is required.
*/
public String getMySQLUsername() throws GuacamoleException {
@Override
public String getUsername() throws GuacamoleException {
return getRequiredProperty(MySQLGuacamoleProperties.MYSQL_USERNAME);
}
/**
* Returns the password that should be used when authenticating with the
* MySQL database containing the Guacamole authentication tables.
*
* @return
* The password for the MySQL database.
*
* @throws GuacamoleException
* If an error occurs while retrieving the property value, or if the
* value was not set, as this property is required.
*/
public String getMySQLPassword() throws GuacamoleException {
@Override
public String getPassword() throws GuacamoleException {
return getRequiredProperty(MySQLGuacamoleProperties.MYSQL_PASSWORD);
}