Search in sources :

Example 1 with PrincipalIteratorAdapter

use of org.apache.jackrabbit.oak.spi.security.principal.PrincipalIteratorAdapter in project jackrabbit-oak by apache.

the class ImpersonationImpl method getImpersonators.

// ------------------------------------------------------< Impersonation >---
/**
 * @see org.apache.jackrabbit.api.security.user.Impersonation#getImpersonators()
 */
@Nonnull
@Override
public PrincipalIterator getImpersonators() throws RepositoryException {
    Set<String> impersonators = getImpersonatorNames();
    if (impersonators.isEmpty()) {
        return PrincipalIteratorAdapter.EMPTY;
    } else {
        Set<Principal> s = new HashSet<Principal>();
        for (final String pName : impersonators) {
            Principal p = principalManager.getPrincipal(pName);
            if (p == null) {
                log.debug("Impersonator " + pName + " does not correspond to a known Principal.");
                p = new PrincipalImpl(pName);
            }
            s.add(p);
        }
        return new PrincipalIteratorAdapter(s);
    }
}
Also used : PrincipalIteratorAdapter(org.apache.jackrabbit.oak.spi.security.principal.PrincipalIteratorAdapter) AdminPrincipal(org.apache.jackrabbit.oak.spi.security.principal.AdminPrincipal) Principal(java.security.Principal) PrincipalImpl(org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl) HashSet(java.util.HashSet) Nonnull(javax.annotation.Nonnull)

Aggregations

Principal (java.security.Principal)1 HashSet (java.util.HashSet)1 Nonnull (javax.annotation.Nonnull)1 AdminPrincipal (org.apache.jackrabbit.oak.spi.security.principal.AdminPrincipal)1 PrincipalImpl (org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl)1 PrincipalIteratorAdapter (org.apache.jackrabbit.oak.spi.security.principal.PrincipalIteratorAdapter)1