From 90ee90973e574248a0b910d37ee67d4cb398fee5 Mon Sep 17 00:00:00 2001 From: Metall <25564543+metallnt@users.noreply.github.com> Date: Wed, 21 Sep 2022 08:40:40 +0500 Subject: [PATCH] Update PasswordVerifier.java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Добавил: 1. Способ верификации "django", для осуществления авторизации с помощью PBKDF2 с SHA256. 2. Исключение на отсутствующий алгоритм(NoSuchAlgorithmException) 3. Исключение на неверные ключи(InvalidKeySpecException) --- .../gravit/launchserver/auth/password/PasswordVerifier.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/password/PasswordVerifier.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/password/PasswordVerifier.java index 30c352e9..4f1eaf66 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/password/PasswordVerifier.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/password/PasswordVerifier.java @@ -2,6 +2,9 @@ import pro.gravit.utils.ProviderMap; +import java.security.NoSuchAlgorithmException; +import java.security.spec.InvalidKeySpecException; + public abstract class PasswordVerifier { public static final ProviderMap providers = new ProviderMap<>("PasswordVerifier"); private static boolean registeredProviders = false; @@ -14,11 +17,12 @@ public static void registerProviders() { providers.register("json", JsonPasswordVerifier.class); providers.register("accept", AcceptPasswordVerifier.class); providers.register("reject", RejectPasswordVerifier.class); + providers.register("django", DjangoPasswordVerifier.class); registeredProviders = true; } } - public abstract boolean check(String encryptedPassword, String password); + public abstract boolean check(String encryptedPassword, String password) throws NoSuchAlgorithmException, InvalidKeySpecException; public String encrypt(String password) { throw new UnsupportedOperationException();