[KEYCLOAK-405]-Fixed deletion of expired Credentials if policy removed.
This commit is contained in:
parent
e3bb61248a
commit
0ff4b6dd93
3 changed files with 12 additions and 0 deletions
|
@ -259,6 +259,10 @@ public class UserAdapter implements UserModel, Comparable {
|
|||
setValue(credentialEntity, cred);
|
||||
user.getCredentials().add(credentialEntity);
|
||||
} else {
|
||||
List<CredentialEntity> credentialEntities = getCredentialEntities(user, UserCredentialModel.PASSWORD_HISTORY);
|
||||
if (credentialEntities != null && credentialEntities.size() > 0) {
|
||||
user.getCredentials().removeAll(credentialEntities);
|
||||
}
|
||||
setValue(credentialEntity, cred);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -260,6 +260,10 @@ public class UserAdapter implements UserModel {
|
|||
em.persist(credentialEntity);
|
||||
user.getCredentials().add(credentialEntity);
|
||||
} else {
|
||||
List<CredentialEntity> credentialEntities = getCredentialEntities(user, UserCredentialModel.PASSWORD_HISTORY);
|
||||
if (credentialEntities != null && credentialEntities.size() > 0) {
|
||||
user.getCredentials().removeAll(credentialEntities);
|
||||
}
|
||||
setValue(credentialEntity, cred);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,6 +227,10 @@ public class UserAdapter extends AbstractMongoAdapter<MongoUserEntity> implement
|
|||
setValue(credentialEntity, cred);
|
||||
user.getCredentials().add(credentialEntity);
|
||||
} else {
|
||||
List<CredentialEntity> credentialEntities = getCredentialEntities(user, UserCredentialModel.PASSWORD_HISTORY);
|
||||
if (credentialEntities != null && credentialEntities.size() > 0) {
|
||||
user.getCredentials().removeAll(credentialEntities);
|
||||
}
|
||||
setValue(credentialEntity, cred);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue