@SuppressWarnings("unchecked") public Collection<SSOUser> getUsers(String nameFilter, Long domainId) throws SecurityException { return (List<SSOUser>) getPrincipals(nameFilter, domainId); }
@SuppressWarnings("unchecked") public Collection<SSOUser> getUsers(JetspeedPrincipal principal, Long remoteSecurityDomain) throws SecurityException { return (Collection<SSOUser>)_getSSOUsersForPrincipal(principal,remoteSecurityDomain); }
public boolean exists(String siteUrl) { return getByUrl(siteUrl) != null; }
public SSOSite add(SSOSite ssoSite) throws SSOException { try { getPersistenceBrokerTemplate().store(ssoSite); cacheSite(ssoSite); return ssoSite; } catch (Exception e) { String msg = "Unable to add SSO Site: " + ssoSite.getName(); log.error(msg, e); throw new SSOException(msg, e); } }
protected void cacheSite(SSOSite site){ if (getCachedSiteByDomainId(site.getSecurityDomainId()) != null){ removeSiteFromCache(site); } mapSiteUrlIndex.put(site.getURL(), site); mapSiteDomainIndex.put(site.getSecurityDomainId(), site); mapSiteNameIndex.put(site.getName(), site); }
public Collection<String> getUserNames(String nameFilter, Long domainId) throws SecurityException { return (List<String>) domainPrincipalAccess.getPrincipalNames(nameFilter, getPrincipalType(), domainId); }
public void remove(SSOSite site) throws SSOException { try { getPersistenceBrokerTemplate().delete(site); removeSiteFromCache(site); } catch (Exception e) { String msg = "Unable to remove SSO Site: " + site.getName(); log.error(msg, e); throw new SSOException(msg, e); } }
public SSOSite getById(int id){ try{ return (SSOSite) getPersistenceBrokerTemplate().getObjectById(SSOSiteImpl.class, id); } catch (ObjectRetrievalFailureException ore){ return null; } }
public void removeUser(String userName, Long domainId) throws SecurityException { JetspeedPrincipal user; user = getUser(userName, domainId); super.removePrincipal(user); }
public SSOSite getSite(SSOUser ssoUser) { Collection<SSOSite> sitesForUser = getSites(Arrays.asList(new SSOUser[]{ ssoUser} )); if (sitesForUser.size() == 1){ return sitesForUser.iterator().next(); } else { return null; } }
public SSOUser addUser(String name, Long domainId, JetspeedPrincipal ownerPrincipal) throws SecurityException { SSOUser user = newUser(name, domainId); Set<JetspeedPrincipalAssociationReference> reqAssociations = new HashSet<JetspeedPrincipalAssociationReference>(); reqAssociations.add(new JetspeedPrincipalAssociationReference(JetspeedPrincipalAssociationReference.Type.TO, ownerPrincipal, IsOwnedByPrincipalAssociationHandler.ASSOCIATION_NAME)); super.addPrincipal(user, reqAssociations); // by default add a relation to the owner super.addAssociation(user, ownerPrincipal, IsRemoteIdentityForPrincipalAssociationHandler.ASSOCIATION_NAME); return user; }
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 SSOSite getByUrl(String siteUrl) { Criteria filter = new Criteria(); filter.addEqualTo("url", siteUrl); Query query = QueryFactory.newQuery(SSOSiteImpl.class, filter); SSOSite site = (SSOSite) getPersistenceBrokerTemplate().getObjectByQuery(query); if (site != null){ cacheSite(site); } return site; }
protected List<? extends JetspeedPrincipal> getPrincipals(String nameFilter, Long domainId) { return domainPrincipalAccess.getPrincipals(nameFilter, getPrincipalType(), domainId); }
@SuppressWarnings("unchecked") public Collection<SSOSite> getSites(String filter) { Criteria finalCriteria = new Criteria(); if (StringUtils.isNotEmpty(filter)){ filter = filter.replaceAll("%", "\\%"); filter = "%"+filter+"%"; Criteria urlCriteria = new Criteria(); urlCriteria.addLike("url", filter); finalCriteria.addOrCriteria(urlCriteria); Criteria nameCriteria = new Criteria(); nameCriteria.addLike("name", filter); finalCriteria.addOrCriteria(nameCriteria); } Query query = QueryFactory.newQuery(SSOSiteImpl.class, finalCriteria); return getPersistenceBrokerTemplate().getCollectionByQuery(query); }
public void update(SSOSite site) throws SSOException { try { getPersistenceBrokerTemplate().store(site); cacheSite(site); } catch (Exception e) { String msg = "Unable to remove SSO Site: " + site.getName(); log.error(msg, e); throw new SSOException(msg, e); } }
public boolean userExists(String userName, Long domainId) { return domainPrincipalAccess.principalExists(userName, getPrincipalType(), domainId); }
public SSOSite getByName(String siteName) { Criteria filter = new Criteria(); filter.addEqualTo("name", siteName); Query query = QueryFactory.newQuery(SSOSiteImpl.class, filter); SSOSite site = (SSOSite) getPersistenceBrokerTemplate().getObjectByQuery(query); if (site != null){ cacheSite(site); } return site; }
public SSOUser getUser(String userName, Long domainId) throws SecurityException { SSOUser user = (SSOUser)domainPrincipalAccess.getPrincipal(userName, getPrincipalType(), domainId); if (null == user) { throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.SSO_USER, userName)); } return user; }
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()); }