From 26194d676db1b36e02b7af3edb142afe9024c77e Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Sat, 14 Jan 2017 22:14:09 +0100 Subject: [PATCH] #1063 Add useSSL option --- docs/config.md | 8 ++++++-- src/main/java/fr/xephi/authme/datasource/MySQL.java | 5 +++++ .../authme/settings/properties/DatabaseSettings.java | 4 ++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/config.md b/docs/config.md index af1e1545d..73c5eed61 100644 --- a/docs/config.md +++ b/docs/config.md @@ -1,5 +1,5 @@ - + ## AuthMe Configuration The first time you run AuthMe it will create a config.yml file in the plugins/AuthMe folder, @@ -34,6 +34,8 @@ DataSource: mySQLRealName: 'realname' # Column for storing players passwords mySQLColumnPassword: 'password' + # Request mysql over SSL + mySQLUseSSL: true # Column for storing players emails mySQLColumnEmail: 'email' # Column for storing if a player is logged in or not @@ -330,6 +332,8 @@ Email: mailAccount: '' # Email account password mailPassword: '' + # Email address, fill when mailAccount is not the email address of the account + mailAddress: '' # Custom sender name, replacing the mailAccount name in the email mailSenderName: '' # Recovery password length @@ -460,4 +464,4 @@ To change settings on a running server, save your changes to config.yml and use --- -This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Sat Jan 07 11:33:48 CET 2017 +This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Sat Jan 14 22:12:16 CET 2017 diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 20ffa6d53..f500ac072 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -31,6 +31,7 @@ import java.util.Set; public class MySQL implements DataSource { + private boolean useSSL; private String host; private String port; private String username; @@ -100,6 +101,7 @@ public class MySQL implements DataSource { if (poolSize == -1) { poolSize = Utils.getCoreCount(); } + this.useSSL = settings.getProperty(DatabaseSettings.MYSQL_USE_SSL); } private void setConnectionArguments() { @@ -116,6 +118,9 @@ public class MySQL implements DataSource { ds.setUsername(this.username); ds.setPassword(this.password); + // Request mysql over SSL + ds.addDataSourceProperty("useSSL", useSSL); + // Encoding ds.addDataSourceProperty("characterEncoding", "utf8"); ds.addDataSourceProperty("encoding","UTF-8"); diff --git a/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java b/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java index e7c0e175d..ed877f87b 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java @@ -58,6 +58,10 @@ public class DatabaseSettings implements SettingsHolder { public static final Property MYSQL_COL_PASSWORD = newProperty("DataSource.mySQLColumnPassword", "password"); + @Comment("Request mysql over SSL") + public static final Property MYSQL_USE_SSL = + newProperty("DataSource.mySQLUseSSL", true); + @Comment("Column for storing players passwords salts") public static final Property MYSQL_COL_SALT = newProperty("ExternalBoardOptions.mySQLColumnSalt", "");