From aff9cd4ad067eef14f3d2d5cf5b5fc46a5ab725d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=ED=95=B8=EB=AA=A8?= Date: Sat, 14 Oct 2023 14:44:06 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20passwordEncoder=20try-catch=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/config/password/PasswordFactory.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/keeper/homepage/global/config/password/PasswordFactory.java b/src/main/java/com/keeper/homepage/global/config/password/PasswordFactory.java index af59b06ee..e57d87ce2 100644 --- a/src/main/java/com/keeper/homepage/global/config/password/PasswordFactory.java +++ b/src/main/java/com/keeper/homepage/global/config/password/PasswordFactory.java @@ -27,10 +27,18 @@ public String encode(CharSequence rawPassword) { @Override public boolean matches(CharSequence rawPassword, String encodedPassword) { - return createDelegatingPasswordEncoder().matches(rawPassword, encodedPassword) + return isMatchInDelegatingPasswordEncoder(rawPassword, encodedPassword) || matchesWithPBKDF2SHA256(rawPassword.toString(), encodedPassword) || matchesWithMD5(rawPassword.toString(), encodedPassword); } + + private boolean isMatchInDelegatingPasswordEncoder(CharSequence rawPassword, String encodedPassword) { + try { + return createDelegatingPasswordEncoder().matches(rawPassword, encodedPassword); + } catch (Exception ignore) { + } + return false; + } }; private static boolean matchesWithPBKDF2SHA256(String password, String hashedPassword) {