Search in sources :

Example 46 with SyncResult

use of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncResult in project jackrabbit-oak by apache.

the class Delegatee method syncAllUsers.

/**
 * @see SynchronizationMBean#syncAllUsers(boolean)
 */
@Nonnull
String[] syncAllUsers(boolean purge) {
    try {
        List<String> list = new ArrayList<String>();
        context.setKeepMissing(!purge).setForceGroupSync(true).setForceUserSync(true);
        Iterator<SyncedIdentity> it = handler.listIdentities(userMgr);
        List<SyncResult> results = new ArrayList<SyncResult>(batchSize);
        while (it.hasNext()) {
            SyncedIdentity id = it.next();
            if (isMyIDP(id)) {
                results = syncUser(id.getId(), false, results, list);
            }
        }
        commit(list, results, NO_BATCH_SIZE);
        return list.toArray(new String[list.size()]);
    } catch (RepositoryException e) {
        throw new IllegalStateException("Error retrieving users for syncing", e);
    }
}
Also used : ArrayList(java.util.ArrayList) RepositoryException(javax.jcr.RepositoryException) DefaultSyncedIdentity(org.apache.jackrabbit.oak.spi.security.authentication.external.basic.DefaultSyncedIdentity) SyncedIdentity(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity) SyncResult(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncResult) Nonnull(javax.annotation.Nonnull)

Aggregations

SyncResult (org.apache.jackrabbit.oak.spi.security.authentication.external.SyncResult)46 Test (org.junit.Test)37 AbstractExternalAuthTest (org.apache.jackrabbit.oak.spi.security.authentication.external.AbstractExternalAuthTest)34 ExternalGroup (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalGroup)14 ExternalUser (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser)13 User (org.apache.jackrabbit.api.security.user.User)11 SyncedIdentity (org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity)11 Group (org.apache.jackrabbit.api.security.user.Group)10 ExternalIdentity (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity)7 ExternalIdentityRef (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityRef)5 Nonnull (javax.annotation.Nonnull)4 Authorizable (org.apache.jackrabbit.api.security.user.Authorizable)4 CommitFailedException (org.apache.jackrabbit.oak.api.CommitFailedException)4 Tree (org.apache.jackrabbit.oak.api.Tree)4 SyncContext (org.apache.jackrabbit.oak.spi.security.authentication.external.SyncContext)4 ArrayList (java.util.ArrayList)3 DefaultSyncContext (org.apache.jackrabbit.oak.spi.security.authentication.external.basic.DefaultSyncContext)3 DefaultSyncedIdentity (org.apache.jackrabbit.oak.spi.security.authentication.external.basic.DefaultSyncedIdentity)3 ExternalIdentityException (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityException)2 SyncException (org.apache.jackrabbit.oak.spi.security.authentication.external.SyncException)2