public Collection<SSOUser> getUsers(JetspeedPrincipal principal) throws SecurityException { Collection<SecurityDomain> allDomains = domainAccess.getDomainsOwnedBy(principal.getDomainId()); Collection<SSOUser> users = new ArrayList<SSOUser>(); for (SecurityDomain domain : allDomains){ users.addAll(getUsers(principal,domain.getDomainId())); } return users; }
public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof JetspeedPrincipal) { JetspeedPrincipal other = (JetspeedPrincipal)o; return (getName().equals(other.getName()) && getType().equals(other.getType()) && (((getDomainId() != null) ? getDomainId().longValue() : 0L) == ((other.getDomainId() != null) ? other.getDomainId().longValue() : 0L))); } return false; }
private Collection<? extends JetspeedPrincipal> _getSSOUsersForPrincipal(JetspeedPrincipal principal, Long remoteSecurityDomain) throws SecurityException { return domainPrincipalAccess.getAssociatedTo(principal.getName(), getPrincipalType(), principal.getType(), IsRemoteIdentityForPrincipalAssociationHandler.ASSOCIATION_NAME, remoteSecurityDomain, principal.getDomainId()); }
if (principal.getDomainId() != null) return principalExists(principal.getName(), principal.getType(), principal.getDomainId()); criteria.addEqualTo("id", principal.getId()); criteria.addEqualTo("type", principal.getType().getName()); criteria.addEqualTo("domainId", principal.getDomainId()); principalExists = (getPersistenceBrokerTemplate().getCount(query) == 1); jspmCache.putPrincipalQuery(cacheKey, (principalExists ? principal.getId() : JSPMCache.ANY_ID), null, principal.getDomainId(), principalExists);
public void revokeAllPermissions(JetspeedPrincipal principal) throws SecurityException { Long principalId = null; Criteria criteria = new Criteria(); if (principal.isTransient() || principal.getId() == null) { Long securityDomain = ((principal.getDomainId() != null) ? principal.getDomainId() : getDefaultSecurityDomainId()); principalId = getPrincipalId(principal.getName(), principal.getType().getName(), securityDomain); } else { principalId = principal.getId(); } criteria.addEqualTo("principalId", principalId); Query query = QueryFactory.newQuery(JetspeedPrincipalPermission.class,criteria); try { getPersistenceBrokerTemplate().deleteByQuery(query); // evict from principal cache to notify jspmCache.evictPrincipal(principalId); } catch (Exception pbe) { KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager", "revokeAllPermissions", pbe.getMessage()); logger.error(msg, pbe); throw new SecurityException(msg, pbe); } }
public void addPrincipal(JetspeedPrincipal principal, Set<JetspeedPrincipalAssociationReference> associations) throws SecurityException { if (principal.getDomainId() == null && principal instanceof TransientJetspeedPrincipal) { ((TransientJetspeedPrincipal)principal).setDomainId(getDefaultSecurityDomainId()); } if (principalExists(principal)) { throw new SecurityException(SecurityException.PRINCIPAL_ALREADY_EXISTS.createScoped(principal.getType().getName(), principal.getName())); } try { getPersistenceBrokerTemplate().store(principal); // evict from and put in cache to notify jspmCache.evictPrincipal(principal.getId()); jspmCache.putPrincipal(principal.getId(), principal); } catch (Exception pbe) { KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager", "addPrincipal", pbe.getMessage()); logger.error(msg, pbe); throw new SecurityException(msg, pbe); } // Note: the (optional) required associations are expected to be stored by the calling JetspeedPrincipalManager }
if (principal.isTransient() || principal.getId() == null) Long securityDomain = ((principal.getDomainId() != null) ? principal.getDomainId() : getDefaultSecurityDomainId()); principalId = getPrincipalId(principal.getName(), principal.getType().getName(), securityDomain);