KEYCLOAK-4081

This commit is contained in:
Stian Thorgersen 2016-12-14 08:43:20 +01:00
parent 90fdb4889c
commit e316037910

View file

@ -172,8 +172,9 @@ public abstract class AbstractUsernameFormAuthenticator extends AbstractFormAuth
List<CredentialInput> credentials = new LinkedList<>(); List<CredentialInput> credentials = new LinkedList<>();
String password = inputData.getFirst(CredentialRepresentation.PASSWORD); String password = inputData.getFirst(CredentialRepresentation.PASSWORD);
credentials.add(UserCredentialModel.password(password)); credentials.add(UserCredentialModel.password(password));
boolean valid = context.getSession().userCredentialManager().isValid(context.getRealm(), user, credentials); if (password != null && !password.isEmpty() && context.getSession().userCredentialManager().isValid(context.getRealm(), user, credentials)) {
if (!valid) { return true;
} else {
context.getEvent().user(user); context.getEvent().user(user);
context.getEvent().error(Errors.INVALID_USER_CREDENTIALS); context.getEvent().error(Errors.INVALID_USER_CREDENTIALS);
Response challengeResponse = invalidCredentials(context); Response challengeResponse = invalidCredentials(context);
@ -181,7 +182,6 @@ public abstract class AbstractUsernameFormAuthenticator extends AbstractFormAuth
context.clearUser(); context.clearUser();
return false; return false;
} }
return true;
} }
} }