fix null pointer

This commit is contained in:
Michael Gerber 2015-11-24 13:54:33 +00:00
parent 142ef50728
commit 9a3e023c43

View file

@ -51,6 +51,10 @@ public class CredentialValidation {
} }
public static boolean validateHashedCredential(RealmModel realm, UserModel user, String unhashedCredValue, UserCredentialValueModel credential) { public static boolean validateHashedCredential(RealmModel realm, UserModel user, String unhashedCredValue, UserCredentialValueModel credential) {
if(unhashedCredValue == null){
return false;
}
boolean validated = new Pbkdf2PasswordEncoder(credential.getSalt()).verify(unhashedCredValue, credential.getValue(), credential.getHashIterations()); boolean validated = new Pbkdf2PasswordEncoder(credential.getSalt()).verify(unhashedCredValue, credential.getValue(), credential.getHashIterations());
if (validated) { if (validated) {
int iterations = hashIterations(realm); int iterations = hashIterations(realm);