mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-641: Standardize database username/password retrieval via JDBCEnvironment.
This commit is contained in:
@@ -166,4 +166,30 @@ public abstract class JDBCEnvironment extends DelegatingEnvironment {
|
|||||||
*/
|
*/
|
||||||
public abstract boolean autoCreateAbsentAccounts() throws GuacamoleException;
|
public abstract boolean autoCreateAbsentAccounts() throws GuacamoleException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the username that should be used when authenticating with the
|
||||||
|
* database containing the Guacamole authentication tables.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* The username for the 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 abstract String getUsername() throws GuacamoleException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the password that should be used authenticating with the
|
||||||
|
* database containing the Guacamole authentication tables.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* The password for the 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 abstract String getPassword() throws GuacamoleException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -72,8 +72,8 @@ public class MySQLAuthenticationProviderModule implements Module {
|
|||||||
myBatisProperties.setProperty("JDBC.host", environment.getMySQLHostname());
|
myBatisProperties.setProperty("JDBC.host", environment.getMySQLHostname());
|
||||||
myBatisProperties.setProperty("JDBC.port", String.valueOf(environment.getMySQLPort()));
|
myBatisProperties.setProperty("JDBC.port", String.valueOf(environment.getMySQLPort()));
|
||||||
myBatisProperties.setProperty("JDBC.schema", environment.getMySQLDatabase());
|
myBatisProperties.setProperty("JDBC.schema", environment.getMySQLDatabase());
|
||||||
myBatisProperties.setProperty("JDBC.username", environment.getMySQLUsername());
|
myBatisProperties.setProperty("JDBC.username", environment.getUsername());
|
||||||
myBatisProperties.setProperty("JDBC.password", environment.getMySQLPassword());
|
myBatisProperties.setProperty("JDBC.password", environment.getPassword());
|
||||||
myBatisProperties.setProperty("JDBC.autoCommit", "false");
|
myBatisProperties.setProperty("JDBC.autoCommit", "false");
|
||||||
myBatisProperties.setProperty("mybatis.pooled.pingEnabled", "true");
|
myBatisProperties.setProperty("mybatis.pooled.pingEnabled", "true");
|
||||||
myBatisProperties.setProperty("mybatis.pooled.pingQuery", "SELECT 1");
|
myBatisProperties.setProperty("mybatis.pooled.pingQuery", "SELECT 1");
|
||||||
|
@@ -242,33 +242,13 @@ public class MySQLEnvironment extends JDBCEnvironment {
|
|||||||
return getRequiredProperty(MySQLGuacamoleProperties.MYSQL_DATABASE);
|
return getRequiredProperty(MySQLGuacamoleProperties.MYSQL_DATABASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Returns the username that should be used when authenticating with the
|
public String getUsername() throws GuacamoleException {
|
||||||
* 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 {
|
|
||||||
return getRequiredProperty(MySQLGuacamoleProperties.MYSQL_USERNAME);
|
return getRequiredProperty(MySQLGuacamoleProperties.MYSQL_USERNAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Returns the password that should be used when authenticating with the
|
public String getPassword() throws GuacamoleException {
|
||||||
* 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 {
|
|
||||||
return getRequiredProperty(MySQLGuacamoleProperties.MYSQL_PASSWORD);
|
return getRequiredProperty(MySQLGuacamoleProperties.MYSQL_PASSWORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -64,8 +64,8 @@ public class PostgreSQLAuthenticationProviderModule implements Module {
|
|||||||
myBatisProperties.setProperty("JDBC.host", environment.getPostgreSQLHostname());
|
myBatisProperties.setProperty("JDBC.host", environment.getPostgreSQLHostname());
|
||||||
myBatisProperties.setProperty("JDBC.port", String.valueOf(environment.getPostgreSQLPort()));
|
myBatisProperties.setProperty("JDBC.port", String.valueOf(environment.getPostgreSQLPort()));
|
||||||
myBatisProperties.setProperty("JDBC.schema", environment.getPostgreSQLDatabase());
|
myBatisProperties.setProperty("JDBC.schema", environment.getPostgreSQLDatabase());
|
||||||
myBatisProperties.setProperty("JDBC.username", environment.getPostgreSQLUsername());
|
myBatisProperties.setProperty("JDBC.username", environment.getUsername());
|
||||||
myBatisProperties.setProperty("JDBC.password", environment.getPostgreSQLPassword());
|
myBatisProperties.setProperty("JDBC.password", environment.getPassword());
|
||||||
myBatisProperties.setProperty("JDBC.autoCommit", "false");
|
myBatisProperties.setProperty("JDBC.autoCommit", "false");
|
||||||
myBatisProperties.setProperty("mybatis.pooled.pingEnabled", "true");
|
myBatisProperties.setProperty("mybatis.pooled.pingEnabled", "true");
|
||||||
myBatisProperties.setProperty("mybatis.pooled.pingQuery", "SELECT 1");
|
myBatisProperties.setProperty("mybatis.pooled.pingQuery", "SELECT 1");
|
||||||
|
@@ -233,33 +233,13 @@ public class PostgreSQLEnvironment extends JDBCEnvironment {
|
|||||||
return getRequiredProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_DATABASE);
|
return getRequiredProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_DATABASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Returns the username that should be used when authenticating with the
|
public String getUsername() throws GuacamoleException {
|
||||||
* PostgreSQL database containing the Guacamole authentication tables.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* The username for the PostgreSQL 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 getPostgreSQLUsername() throws GuacamoleException {
|
|
||||||
return getRequiredProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_USERNAME);
|
return getRequiredProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_USERNAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Returns the password that should be used when authenticating with the
|
public String getPassword() throws GuacamoleException {
|
||||||
* PostgreSQL database containing the Guacamole authentication tables.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* The password for the PostgreSQL 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 getPostgreSQLPassword() throws GuacamoleException {
|
|
||||||
return getRequiredProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_PASSWORD);
|
return getRequiredProperty(PostgreSQLGuacamoleProperties.POSTGRESQL_PASSWORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -69,8 +69,8 @@ public class SQLServerAuthenticationProviderModule implements Module {
|
|||||||
myBatisProperties.setProperty("JDBC.host", environment.getSQLServerHostname());
|
myBatisProperties.setProperty("JDBC.host", environment.getSQLServerHostname());
|
||||||
myBatisProperties.setProperty("JDBC.port", String.valueOf(environment.getSQLServerPort()));
|
myBatisProperties.setProperty("JDBC.port", String.valueOf(environment.getSQLServerPort()));
|
||||||
myBatisProperties.setProperty("JDBC.schema", environment.getSQLServerDatabase());
|
myBatisProperties.setProperty("JDBC.schema", environment.getSQLServerDatabase());
|
||||||
myBatisProperties.setProperty("JDBC.username", environment.getSQLServerUsername());
|
myBatisProperties.setProperty("JDBC.username", environment.getUsername());
|
||||||
myBatisProperties.setProperty("JDBC.password", environment.getSQLServerPassword());
|
myBatisProperties.setProperty("JDBC.password", environment.getPassword());
|
||||||
|
|
||||||
myBatisProperties.setProperty("JDBC.autoCommit", "false");
|
myBatisProperties.setProperty("JDBC.autoCommit", "false");
|
||||||
myBatisProperties.setProperty("mybatis.pooled.pingEnabled", "true");
|
myBatisProperties.setProperty("mybatis.pooled.pingEnabled", "true");
|
||||||
|
@@ -222,33 +222,13 @@ public class SQLServerEnvironment extends JDBCEnvironment {
|
|||||||
return getRequiredProperty(SQLServerGuacamoleProperties.SQLSERVER_DATABASE);
|
return getRequiredProperty(SQLServerGuacamoleProperties.SQLSERVER_DATABASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Returns the username that should be used when authenticating with the
|
public String getUsername() throws GuacamoleException {
|
||||||
* SQLServer database containing the Guacamole authentication tables.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* The username for the SQLServer 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 getSQLServerUsername() throws GuacamoleException {
|
|
||||||
return getRequiredProperty(SQLServerGuacamoleProperties.SQLSERVER_USERNAME);
|
return getRequiredProperty(SQLServerGuacamoleProperties.SQLSERVER_USERNAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Returns the password that should be used when authenticating with the
|
public String getPassword() throws GuacamoleException {
|
||||||
* SQLServer database containing the Guacamole authentication tables.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* The password for the SQLServer 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 getSQLServerPassword() throws GuacamoleException {
|
|
||||||
return getRequiredProperty(SQLServerGuacamoleProperties.SQLSERVER_PASSWORD);
|
return getRequiredProperty(SQLServerGuacamoleProperties.SQLSERVER_PASSWORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user