Search in sources :

Example 1 with PrincipalIteratorAdapter

use of org.apache.jackrabbit.core.security.principal.PrincipalIteratorAdapter in project jackrabbit by apache.

the class ImpersonationImpl method getImpersonators.

//------------------------------------------------------< Impersonation >---
/**
     * @see Impersonation#getImpersonators()
     */
public PrincipalIterator getImpersonators() throws RepositoryException {
    Set<String> impersonators = getImpersonatorNames();
    if (impersonators.isEmpty()) {
        return PrincipalIteratorAdapter.EMPTY;
    } else {
        final PrincipalManager pMgr = user.getSession().getPrincipalManager();
        Set<Principal> s = new HashSet<Principal>();
        for (String pName : impersonators) {
            Principal p = pMgr.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 : PrincipalManager(org.apache.jackrabbit.api.security.principal.PrincipalManager) PrincipalIteratorAdapter(org.apache.jackrabbit.core.security.principal.PrincipalIteratorAdapter) Principal(java.security.Principal) PrincipalImpl(org.apache.jackrabbit.core.security.principal.PrincipalImpl) HashSet(java.util.HashSet)

Aggregations

Principal (java.security.Principal)1 HashSet (java.util.HashSet)1 PrincipalManager (org.apache.jackrabbit.api.security.principal.PrincipalManager)1 PrincipalImpl (org.apache.jackrabbit.core.security.principal.PrincipalImpl)1 PrincipalIteratorAdapter (org.apache.jackrabbit.core.security.principal.PrincipalIteratorAdapter)1