mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-1239: Make sure case sensitivity warnings are only displayed at startup.
This commit is contained in:
@@ -30,12 +30,19 @@ import org.apache.guacamole.auth.mysql.conf.MySQLDriver;
|
|||||||
import org.apache.guacamole.auth.mysql.conf.MySQLEnvironment;
|
import org.apache.guacamole.auth.mysql.conf.MySQLEnvironment;
|
||||||
import org.apache.guacamole.auth.mysql.conf.MySQLSSLMode;
|
import org.apache.guacamole.auth.mysql.conf.MySQLSSLMode;
|
||||||
import org.mybatis.guice.datasource.helper.JdbcHelper;
|
import org.mybatis.guice.datasource.helper.JdbcHelper;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Guice module which configures MySQL-specific injections.
|
* Guice module which configures MySQL-specific injections.
|
||||||
*/
|
*/
|
||||||
public class MySQLAuthenticationProviderModule implements Module {
|
public class MySQLAuthenticationProviderModule implements Module {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logger for this class.
|
||||||
|
*/
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(MySQLAuthenticationProviderModule.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MyBatis-specific configuration properties.
|
* MyBatis-specific configuration properties.
|
||||||
*/
|
*/
|
||||||
@@ -122,6 +129,15 @@ public class MySQLAuthenticationProviderModule implements Module {
|
|||||||
if (serverTz != null)
|
if (serverTz != null)
|
||||||
driverProperties.setProperty("serverTimezone", serverTz.getID());
|
driverProperties.setProperty("serverTimezone", serverTz.getID());
|
||||||
|
|
||||||
|
// Check for case-sensitivity and warn admin
|
||||||
|
if (environment.getCaseSensitiveUsernames())
|
||||||
|
LOGGER.warn("The MySQL module is currently configured to support "
|
||||||
|
+ "case-sensitive username comparisons, however, the default "
|
||||||
|
+ "collations for MySQL databases do not support "
|
||||||
|
+ "case-sensitive string comparisons. If you want usernames "
|
||||||
|
+ "within Guacamole to be treated as case-sensitive, further "
|
||||||
|
+ "database configuration may be required.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -446,23 +446,12 @@ public class MySQLEnvironment extends JDBCEnvironment {
|
|||||||
@Override
|
@Override
|
||||||
public boolean getCaseSensitiveUsernames() throws GuacamoleException {
|
public boolean getCaseSensitiveUsernames() throws GuacamoleException {
|
||||||
|
|
||||||
// Get the configured value for the property.
|
// Return the configured value for the property, or the global value.
|
||||||
boolean caseSensitiveUsernames = getProperty(
|
return getProperty(
|
||||||
MySQLGuacamoleProperties.MYSQL_CASE_SENSITIVE_USERNAMES,
|
MySQLGuacamoleProperties.MYSQL_CASE_SENSITIVE_USERNAMES,
|
||||||
super.getCaseSensitiveUsernames()
|
super.getCaseSensitiveUsernames()
|
||||||
);
|
);
|
||||||
|
|
||||||
// If property has been set to true, warn the admin.
|
|
||||||
if (caseSensitiveUsernames)
|
|
||||||
logger.warn("You have enabled case-sensitive usernames; however, "
|
|
||||||
+ "MySQL's default collations do not support case-sensitive "
|
|
||||||
+ "string comparisons. If you really want case-sensitive "
|
|
||||||
+ "usernames you will need to configure your database "
|
|
||||||
+ "appropriately.");
|
|
||||||
|
|
||||||
// Return the configured setting.
|
|
||||||
return caseSensitiveUsernames;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,12 +28,19 @@ import org.apache.guacamole.GuacamoleException;
|
|||||||
import org.apache.guacamole.auth.sqlserver.conf.SQLServerDriver;
|
import org.apache.guacamole.auth.sqlserver.conf.SQLServerDriver;
|
||||||
import org.apache.guacamole.auth.sqlserver.conf.SQLServerEnvironment;
|
import org.apache.guacamole.auth.sqlserver.conf.SQLServerEnvironment;
|
||||||
import org.mybatis.guice.datasource.helper.JdbcHelper;
|
import org.mybatis.guice.datasource.helper.JdbcHelper;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Guice module which configures SQLServer-specific injections.
|
* Guice module which configures SQLServer-specific injections.
|
||||||
*/
|
*/
|
||||||
public class SQLServerAuthenticationProviderModule implements Module {
|
public class SQLServerAuthenticationProviderModule implements Module {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logger for this class.
|
||||||
|
*/
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(SQLServerAuthenticationProviderModule.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MyBatis-specific configuration properties.
|
* MyBatis-specific configuration properties.
|
||||||
*/
|
*/
|
||||||
@@ -89,6 +96,15 @@ public class SQLServerAuthenticationProviderModule implements Module {
|
|||||||
// Capture which driver to use for the connection.
|
// Capture which driver to use for the connection.
|
||||||
this.sqlServerDriver = environment.getSQLServerDriver();
|
this.sqlServerDriver = environment.getSQLServerDriver();
|
||||||
|
|
||||||
|
// Check for case-sensitivity and warn admin.
|
||||||
|
if (environment.getCaseSensitiveUsernames())
|
||||||
|
LOGGER.warn("The SQL Server module is currently configured to support "
|
||||||
|
+ "case-sensitive username comparisons, however, the default "
|
||||||
|
+ "collations for SQL Server databases do not support "
|
||||||
|
+ "case-sensitive string comparisons. If you want usernames "
|
||||||
|
+ "within Guacamole to be treated as case-sensitive, further "
|
||||||
|
+ "database configuration may be required.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -338,15 +338,6 @@ public class SQLServerEnvironment extends JDBCEnvironment {
|
|||||||
super.getCaseSensitiveUsernames()
|
super.getCaseSensitiveUsernames()
|
||||||
);
|
);
|
||||||
|
|
||||||
// If property has been set to true, warn the admin.
|
|
||||||
if (caseSensitiveUsernames)
|
|
||||||
logger.warn("You have configured this extension for case-sensitive "
|
|
||||||
+ "username comparisons, however, the default collations "
|
|
||||||
+ "for SQL Server databases do not support case-sensitive "
|
|
||||||
+ "string comparisons. Further database configuration may "
|
|
||||||
+ "be required in order for case-sensitive username "
|
|
||||||
+ "comparisons to function correctly.");
|
|
||||||
|
|
||||||
// Return as configured
|
// Return as configured
|
||||||
return caseSensitiveUsernames;
|
return caseSensitiveUsernames;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user