UserManager userManager = getUserManager();
if (root == null || userManager == null) {
throw new LoginException("Cannot synchronize user.");
}
context = syncHandler.createContext(idp, userManager, root);
context.sync(externalUser);
root.commit();
Set<? extends Principal> principals = getPrincipals(externalUser.getId());
if (!principals.isEmpty()) {
if (!subject.isReadOnly()) {