create ExternalSettings then move BCRYPT_LOG2_ROUND to it (fix build work 4)

This commit is contained in:
MC~蛟龙 2024-07-11 21:41:17 +08:00
parent 7ba3d46416
commit 20f0bb1984
7 changed files with 23 additions and 6 deletions

View File

@ -62,10 +62,6 @@ public final class HooksSettings implements SettingsHolder {
public static final Property<List<String>> MYSQL_OTHER_USERNAME_COLS = public static final Property<List<String>> MYSQL_OTHER_USERNAME_COLS =
newListProperty("ExternalBoardOptions.mySQLOtherUsernameColumns"); newListProperty("ExternalBoardOptions.mySQLOtherUsernameColumns");
@Comment("How much log2 rounds needed in BCrypt (do not change if you do not know what it does)")
public static final Property<Integer> BCRYPT_LOG2_ROUND =
newProperty("ExternalBoardOptions.bCryptLog2Round", 12);
@Comment("phpBB table prefix defined during the phpBB installation process") @Comment("phpBB table prefix defined during the phpBB installation process")
public static final Property<String> PHPBB_TABLE_PREFIX = public static final Property<String> PHPBB_TABLE_PREFIX =
newProperty("ExternalBoardOptions.phpbbTablePrefix", "phpbb_"); newProperty("ExternalBoardOptions.phpbbTablePrefix", "phpbb_");

View File

@ -0,0 +1,21 @@
package fr.xephi.authme.settings.properties;
import ch.jalu.configme.Comment;
import ch.jalu.configme.SettingsHolder;
import ch.jalu.configme.properties.Property;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
/**
* ExternalSettings
*
* @author TheFloodDragon
* @since 2024/7/11 21:39
*/
public final class ExternalSettings implements SettingsHolder {
@Comment("How much log2 rounds needed in BCrypt (do not change if you do not know what it does)")
public static final Property<Integer> BCRYPT_LOG2_ROUND =
newProperty("ExternalBoardOptions.bCryptLog2Round", 12);
}

View File

@ -2,7 +2,7 @@ package fr.xephi.authme.security.crypts;
import at.favre.lib.crypto.bcrypt.BCrypt.Version; import at.favre.lib.crypto.bcrypt.BCrypt.Version;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
import fr.xephi.authme.settings.properties.HooksSettings; import fr.xephi.authme.settings.properties.ExternalSettings;
import javax.inject.Inject; import javax.inject.Inject;
@ -17,7 +17,7 @@ public class BCrypt extends BCryptBasedHash {
} }
private static BCryptHasher createHasher(Settings settings) { private static BCryptHasher createHasher(Settings settings) {
int bCryptLog2Rounds = settings.getProperty(HooksSettings.BCRYPT_LOG2_ROUND); int bCryptLog2Rounds = settings.getProperty(ExternalSettings.BCRYPT_LOG2_ROUND);
return new BCryptHasher(Version.VERSION_2A, bCryptLog2Rounds); return new BCryptHasher(Version.VERSION_2A, bCryptLog2Rounds);
} }
} }