Minor - make AuthMe.database private

- In favor of AuthMe.getDataSource()
This commit is contained in:
ljacqu
2015-12-29 11:55:57 +01:00
parent 571cb6d36b
commit 531327dd9b
17 changed files with 98 additions and 158 deletions
@@ -28,16 +28,6 @@ public class PasswordSecurity {
this.supportOldAlgorithm = supportOldAlgorithm;
}
@Deprecated
public static String createSalt(int length) {
return RandomString.generateHex(length);
}
@Deprecated
public static String getHash(HashAlgorithm alg, String password, String playerName) throws NoSuchAlgorithmException {
return "";
}
@Deprecated
public static boolean comparePasswordWithHash(String password, String hash,
String playerName) throws NoSuchAlgorithmException {
@@ -142,12 +132,12 @@ public class PasswordSecurity {
try {
EncryptionMethod method = algo.getClazz().newInstance();
if (method.comparePassword(hash, password, salt, playerName)) {
PlayerAuth nAuth = AuthMe.getInstance().database.getAuth(playerName);
PlayerAuth nAuth = AuthMe.getInstance().getDataSource().getAuth(playerName);
if (nAuth != null) {
nAuth.setHash(getHash(Settings.getPasswordHash, password, playerName));
// nAuth.setHash(getHash(Settings.getPasswordHash, password, playerName));
nAuth.setSalt(userSalt.containsKey(playerName) ? userSalt.get(playerName) : "");
AuthMe.getInstance().database.updatePassword(nAuth);
AuthMe.getInstance().database.updateSalt(nAuth);
AuthMe.getInstance().getDataSource().updatePassword(nAuth);
AuthMe.getInstance().getDataSource().updateSalt(nAuth);
}
return true;
}