Last active
May 1, 2018 20:34
-
-
Save lusabo/087aa135dd990a2f2207a9bf8b97df4c to your computer and use it in GitHub Desktop.
PasswordUtils
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.eco.security; | |
// Imports | |
public class PasswordUtils { | |
@Autowired | |
private static BCryptPasswordEncoder encoder; | |
public static String generateBCrypt(String password) { | |
if (password == null) { | |
return password; | |
} | |
return encoder.encode(password); | |
} | |
private static boolean validatePassword(String password, String encoded) { | |
return encoder.matches(password, encoded); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment