mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-926: Add configuration option for enabling self-signed SQL Server certs for local testing.
This commit is contained in:
@@ -76,6 +76,10 @@ public class SQLServerAuthenticationProviderModule implements Module {
|
||||
|
||||
// Use UTF-8 in database
|
||||
driverProperties.setProperty("characterEncoding", "UTF-8");
|
||||
|
||||
// Trust unknown server certificates if configured to do so
|
||||
if (environment.trustAllServerCertificates())
|
||||
driverProperties.setProperty("trustServerCertificate", "true");
|
||||
|
||||
// Retrieve instance name and set it
|
||||
String instance = environment.getSQLServerInstance();
|
||||
|
@@ -295,4 +295,21 @@ public class SQLServerEnvironment extends JDBCEnvironment {
|
||||
true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if all server certificates should be trusted, including
|
||||
* those signed by an unknown certificate authority, such as self-signed
|
||||
* certificates, or false otherwise.
|
||||
*
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while retrieving the property value, or if the
|
||||
* value was not set, as this property is required.
|
||||
*/
|
||||
public boolean trustAllServerCertificates() throws GuacamoleException {
|
||||
|
||||
// Do not trust unknown certificates unless explicitly enabled
|
||||
return getProperty(
|
||||
SQLServerGuacamoleProperties.SQLSERVER_TRUST_ALL_SERVER_CERTIFICATES,
|
||||
false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -245,4 +245,17 @@ public class SQLServerGuacamoleProperties {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Whether or not all server certificates should be trusted, including those
|
||||
* signed by an unknown certificate authority, such as self-signed
|
||||
* certificates.
|
||||
*/
|
||||
public static final BooleanGuacamoleProperty SQLSERVER_TRUST_ALL_SERVER_CERTIFICATES =
|
||||
new BooleanGuacamoleProperty() {
|
||||
|
||||
@Override
|
||||
public String getName() { return "sqlserver-trust-all-server-certificates"; }
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user