use of com.sun.identity.idm.plugins.internal.SpecialRepo in project OpenAM by OpenRock.
the class IdServicesImpl method getSpecialIdentities.
public IdSearchResults getSpecialIdentities(SSOToken token, IdType type, String orgName) throws IdRepoException, SSOException {
Set pluginClasses = new OrderedSet();
if (ServiceManager.isConfigMigratedTo70() && ServiceManager.getBaseDN().equalsIgnoreCase(orgName)) {
// Check the cache
if (specialIdentities != null) {
return (specialIdentities);
}
// get the "SpecialUser plugin
Set repos = idrepoCache.getIdRepoPlugins(orgName);
for (Iterator items = repos.iterator(); items.hasNext(); ) {
IdRepo repo = (IdRepo) items.next();
if (repo instanceof SpecialRepo) {
pluginClasses.add(repo);
}
}
}
// If no plugins found, return empty results
if (pluginClasses.isEmpty()) {
return (emptyUserIdentities);
} else {
IdRepo specialRepo = (IdRepo) pluginClasses.iterator().next();
CrestQuery crestQuery = new CrestQuery("*");
RepoSearchResults res = specialRepo.search(token, type, crestQuery, 0, 0, Collections.EMPTY_SET, false, 0, Collections.EMPTY_MAP, false);
Object[][] obj = new Object[1][2];
obj[0][0] = res;
obj[0][1] = Collections.EMPTY_MAP;
specialIdentities = combineSearchResults(token, obj, 1, type, orgName, false, null);
}
return (specialIdentities);
}
use of com.sun.identity.idm.plugins.internal.SpecialRepo in project OpenAM by OpenRock.
the class IdServicesImpl method getSupportedOperations.
public Set getSupportedOperations(SSOToken token, IdType type, String amOrgName) throws IdRepoException, SSOException {
// First get the list of plugins that support the create operation.
Set unionSupportedOps = new HashSet();
Set configuredPluginClasses = idrepoCache.getIdRepoPlugins(amOrgName);
if (configuredPluginClasses == null || configuredPluginClasses.isEmpty()) {
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, IdRepoErrorCode.NO_PLUGINS_CONFIGURED, null);
}
Iterator it = configuredPluginClasses.iterator();
while (it.hasNext()) {
IdRepo repo = (IdRepo) it.next();
if (repo instanceof SpecialRepo) {
continue;
}
Set supportedOps = repo.getSupportedOperations(type);
if (supportedOps != null && !supportedOps.isEmpty()) {
unionSupportedOps.addAll(supportedOps);
}
}
return unionSupportedOps;
}
use of com.sun.identity.idm.plugins.internal.SpecialRepo in project OpenAM by OpenRock.
the class IdServicesImpl method isSpecialIdentity.
protected boolean isSpecialIdentity(SSOToken token, String name, IdType type, String orgName) throws IdRepoException, SSOException {
if (ServiceManager.isConfigMigratedTo70() && ServiceManager.getBaseDN().equalsIgnoreCase(orgName) && type.equals(IdType.USER)) {
// Check the cache
if (specialIdentityNames == null) {
// get the "SpecialUser plugin
Set spIds = new CaseInsensitiveHashSet();
Set repos = idrepoCache.getIdRepoPlugins(orgName);
for (Iterator items = repos.iterator(); items.hasNext(); ) {
IdRepo repo = (IdRepo) items.next();
if (repo instanceof SpecialRepo) {
CrestQuery crestQuery = new CrestQuery("*");
RepoSearchResults res = repo.search(token, type, crestQuery, 0, 0, Collections.EMPTY_SET, false, 0, Collections.EMPTY_MAP, false);
Set identities = res.getSearchResults();
for (Iterator ids = identities.iterator(); ids.hasNext(); ) {
spIds.add(ids.next());
}
}
}
specialIdentityNames = spIds;
}
if ((specialIdentityNames != null) && !specialIdentityNames.isEmpty()) {
return (specialIdentityNames.contains(name));
}
}
return (false);
}
Aggregations