Implement allowPublicKeyRetrieval option in mysql datasource
This commit is contained in:
@@ -39,6 +39,7 @@ public class MySQL extends AbstractSqlDataSource {
|
||||
|
||||
private boolean useSsl;
|
||||
private boolean serverCertificateVerification;
|
||||
private boolean allowPublicKeyRetrieval;
|
||||
private String host;
|
||||
private String port;
|
||||
private String username;
|
||||
@@ -118,6 +119,7 @@ public class MySQL extends AbstractSqlDataSource {
|
||||
this.maxLifetime = settings.getProperty(DatabaseSettings.MYSQL_CONNECTION_MAX_LIFETIME);
|
||||
this.useSsl = settings.getProperty(DatabaseSettings.MYSQL_USE_SSL);
|
||||
this.serverCertificateVerification = settings.getProperty(DatabaseSettings.MYSQL_CHECK_SERVER_CERTIFICATE);
|
||||
this.allowPublicKeyRetrieval = settings.getProperty(DatabaseSettings.MYSQL_ALLOW_PUBLIC_KEY_RETRIEVAL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,6 +149,9 @@ public class MySQL extends AbstractSqlDataSource {
|
||||
// Disabling server certificate verification on need
|
||||
if (!serverCertificateVerification) {
|
||||
ds.addDataSourceProperty("verifyServerCertificate", String.valueOf(false));
|
||||
} // Disabling server certificate verification on need
|
||||
if (allowPublicKeyRetrieval) {
|
||||
ds.addDataSourceProperty("allowPublicKeyRetrieval", String.valueOf(true));
|
||||
}
|
||||
|
||||
// Encoding
|
||||
|
||||
@@ -37,6 +37,11 @@ public final class DatabaseSettings implements SettingsHolder {
|
||||
public static final Property<Boolean> MYSQL_CHECK_SERVER_CERTIFICATE =
|
||||
newProperty( "DataSource.mySQLCheckServerCertificate", true );
|
||||
|
||||
@Comment({"Authorize client to retrieve RSA server public key.",
|
||||
"Advanced option, ignore if you don't know what it means."})
|
||||
public static final Property<Boolean> MYSQL_ALLOW_PUBLIC_KEY_RETRIEVAL =
|
||||
newProperty( "DataSource.mySQLAllowPublicKeyRetrieval", true );
|
||||
|
||||
@Comment("Username to connect to the MySQL database")
|
||||
public static final Property<String> MYSQL_USERNAME =
|
||||
newProperty("DataSource.mySQLUsername", "authme");
|
||||
|
||||
Reference in New Issue
Block a user