KEYCLOAK-6308 Disable secret question credentials fails
This commit is contained in:
parent
7a978ff3f6
commit
a4fd7e9f7f
1 changed files with 5 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue