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) {