KEYCLOAK-2973 Persist federated identity on token update
This commit is contained in:
parent
49dc5363bb
commit
2f4c2c20f9
1 changed files with 4 additions and 0 deletions
|
@ -372,7 +372,11 @@ public class MongoUserProvider implements UserProvider {
|
||||||
MongoUserEntity userEntity = mongoUser.getUser();
|
MongoUserEntity userEntity = mongoUser.getUser();
|
||||||
FederatedIdentityEntity federatedIdentityEntity = findFederatedIdentityLink(userEntity, federatedIdentityModel.getIdentityProvider());
|
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());
|
federatedIdentityEntity.setToken(federatedIdentityModel.getToken());
|
||||||
|
getMongoStore().pushItemToList(userEntity, "federatedIdentities", federatedIdentityEntity, true, invocationContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue