Skip to content

Commit

Permalink
fix: passwordEncoder try-catch 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
gusah009 committed Oct 14, 2023
1 parent 0874bfe commit aff9cd4
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit aff9cd4

Please sign in to comment.