KEYCLOAK-2973 Persist federated identity on token update

This commit is contained in:
Dane Barentine 2016-05-05 14:51:17 -07:00
parent 49dc5363bb
commit 2f4c2c20f9

View file

@ -372,7 +372,11 @@ public class MongoUserProvider implements UserProvider {
MongoUserEntity userEntity = mongoUser.getUser();
FederatedIdentityEntity federatedIdentityEntity = findFederatedIdentityLink(userEntity, federatedIdentityModel.getIdentityProvider());
//pushItemToList updates the whole federatedIdentities array in Mongo so we just need to remove this object from the Java
//List and pushItemToList will handle the DB update.
userEntity.getFederatedIdentities().remove(federatedIdentityEntity);
federatedIdentityEntity.setToken(federatedIdentityModel.getToken());
getMongoStore().pushItemToList(userEntity, "federatedIdentities", federatedIdentityEntity, true, invocationContext);
}
@Override