Skip to content

Instantly share code, notes, and snippets.

@lusabo
Last active May 1, 2018 20:34
Show Gist options
  • Save lusabo/087aa135dd990a2f2207a9bf8b97df4c to your computer and use it in GitHub Desktop.
Save lusabo/087aa135dd990a2f2207a9bf8b97df4c to your computer and use it in GitHub Desktop.
PasswordUtils
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