KEYCLOAK-6308 Disable secret question credentials fails

This commit is contained in:
Martin Kanis 2018-07-31 09:51:29 +02:00 committed by Hynek Mlnařík
parent 7a978ff3f6
commit a4fd7e9f7f

View file

@ -85,9 +85,12 @@ public class SecretQuestionCredentialProvider implements CredentialProvider, Cre
@Override @Override
public void disableCredentialType(RealmModel realm, UserModel user, String credentialType) { public void disableCredentialType(RealmModel realm, UserModel user, String credentialType) {
if (!SECRET_QUESTION.equals(credentialType)) return; if (!SECRET_QUESTION.equals(credentialType)) return;
session.userCredentialManager().disableCredentialType(realm, user, credentialType);
session.userCache().evict(realm, user);
List<CredentialModel> credentials = session.userCredentialManager().getStoredCredentialsByType(realm, user, SECRET_QUESTION);
for (CredentialModel cred : credentials) {
session.userCredentialManager().removeStoredCredential(realm, user, cred.getId());
}
session.userCache().evict(realm, user);
} }
@Override @Override