remove toggle federation when syncing

This commit is contained in:
Hugo Renard 2022-04-29 10:42:03 +02:00
parent a0958f728d
commit ff58a5664b
Signed by: hougo
GPG key ID: 3A285FD470209C59
2 changed files with 4 additions and 4 deletions

View file

@ -72,6 +72,10 @@ public class ScimClient {
M kcModel) {
var adapter = getAdapter(aClass);
adapter.apply(kcModel);
// If mapping exist then it was created by import so skip.
if (adapter.query("findById", adapter.getId()).getSingleResult() != null) {
return;
}
var retry = registry.retry("create-" + adapter.getId());
var resource = retry.executeSupplier(() -> {
try {

View file

@ -110,13 +110,9 @@ public class ScimStorageProviderFactory
RealmModel realm = session.realms().getRealm(realmId);
session.getContext().setRealm(realm);
var client = new ScimClient(model, session);
model.setEnabled(false);
realm.updateComponent(model);
client.sync(UserAdapter.class, result);
client.sync(GroupAdapter.class, result);
client.close();
model.setEnabled(true);
realm.updateComponent(model);
}
});