use of com.sun.identity.shared.datastruct.OrderedSet in project OpenAM by OpenRock.
the class SCSAML2SOAPBindingRequestHandlerListEditViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
if (populateValues) {
int index = Integer.parseInt((String) getPageSessionAttribute(PGATTR_INDEX));
Map mapAttrs = (Map) getPageSessionAttribute(SCSAML2SOAPBindingViewBean.PROPERTY_ATTRIBUTE);
OrderedSet set = (OrderedSet) mapAttrs.get(SCSAML2SOAPBindingModelImpl.ATTRIBUTE_NAME_REQUEST_HANDLER_LIST);
setValues((String) set.get(index));
}
}
use of com.sun.identity.shared.datastruct.OrderedSet in project OpenAM by OpenRock.
the class IdRepoPluginsCache method getIdRepoPlugins.
protected Set getIdRepoPlugins(String orgName, IdOperation op, IdType type) throws IdRepoException, SSOException {
if (debug.messageEnabled()) {
debug.message("IdRepoPluginsCache.getIdRepoPlugins for " + "OrgName: " + orgName + " Op: " + op + " Type: " + type);
}
String cacheName = DNUtils.normalizeDN(orgName) + op.toString() + type.toString();
Set answer = (Set) readonlyPlugins.get(cacheName);
if ((answer != null) && !answer.isEmpty()) {
return (answer);
}
answer = new OrderedSet();
Set plugins = getIdRepoPlugins(orgName);
if ((plugins != null) && !plugins.isEmpty()) {
for (Iterator items = plugins.iterator(); items.hasNext(); ) {
IdRepo repo = (IdRepo) items.next();
if (repo.getSupportedTypes().contains(type)) {
Set ops = repo.getSupportedOperations(type);
if (ops.contains(op)) {
answer.add(repo);
}
}
}
}
if (debug.messageEnabled()) {
Set ps = new HashSet();
for (Iterator items = answer.iterator(); items.hasNext(); ) {
IdRepo repo = (IdRepo) items.next();
ps.add(repo.getClass().getName());
}
debug.message("IdRepoPluginsCache.getIdRepoPlugins retuned for" + " OrgName: " + orgName + " Op: " + op + " Type: " + type + " Plugins: " + ps);
}
synchronized (idrepoPlugins) {
if (answer != null) {
readonlyPlugins.put(cacheName, answer);
}
}
return (answer);
}
use of com.sun.identity.shared.datastruct.OrderedSet in project OpenAM by OpenRock.
the class IdRepoPluginsCache method getIdRepoPlugins.
protected Set getIdRepoPlugins(String orgName) throws IdRepoException, SSOException {
if (debug.messageEnabled()) {
debug.message("IdRepoPluginsCache.getIdRepoPlugins orgName: " + orgName);
}
// Check the cache
Map orgRepos = null;
orgName = DNUtils.normalizeDN(orgName);
Set readOrgRepos = (Set) readonlyPlugins.get(orgName);
if ((readOrgRepos != null) && !readOrgRepos.isEmpty()) {
return (readOrgRepos);
}
synchronized (idrepoPlugins) {
orgRepos = (Map) idrepoPlugins.get(orgName);
if (orgRepos == null) {
try {
if (debug.messageEnabled()) {
debug.message("IdRepoPluginsCache.getIdRepoPlugins " + "Not in cache for: " + orgName);
}
// Initialize the plugins
orgRepos = new LinkedHashMap();
ServiceConfig sc = idRepoServiceConfigManager.getOrganizationConfig(orgName, null);
if (sc == null) {
// Organization does not exist. Error condition
debug.error("IdRepoPluginsCache.getIdRepoPlugins " + "Org does not exisit: " + orgName);
Object[] args = { orgName };
throw new IdRepoException(IdRepoBundle.BUNDLE_NAME, IdRepoErrorCode.REALM_DOESNT_EXIST, args);
}
Set subConfigNames = sc.getSubConfigNames();
if (debug.messageEnabled()) {
debug.message("IdRepoPluginsCache.getIdRepoPlugins " + "Loading plugins: " + subConfigNames);
}
if (subConfigNames != null && !subConfigNames.isEmpty()) {
for (Iterator items = subConfigNames.iterator(); items.hasNext(); ) {
String idRepoName = (String) items.next();
ServiceConfig reposc = sc.getSubConfig(idRepoName);
if (reposc == null) {
debug.error("IdRepoPluginsCache." + "getIdRepoPlugins SubConfig is null for" + " orgName: " + orgName + " subConfig Name: " + idRepoName);
}
IdRepo repo = constructIdRepoPlugin(orgName, reposc.getAttributesForRead(), idRepoName);
// Add to cache
orgRepos.put(idRepoName, repo);
}
}
// Add internal repos
addInternalRepo(orgRepos, orgName);
idrepoPlugins.put(orgName, orgRepos);
} catch (SMSException ex) {
debug.error("IdRepoPluginsCache.getIdRepoPlugins " + "SMS Exception for orgName: " + orgName, ex);
}
}
// Cache a readonly copy
if (orgRepos != null) {
readOrgRepos = new OrderedSet();
readOrgRepos.addAll(orgRepos.values());
readonlyPlugins.put(orgName, readOrgRepos);
}
}
if (debug.messageEnabled() && (readOrgRepos != null)) {
Set ps = new HashSet();
for (Iterator items = readOrgRepos.iterator(); items.hasNext(); ) {
ps.add(items.next().getClass().getName());
}
debug.message("IdRepoPluginsCache.getIdRepoPlugins retuned for" + " OrgName: " + orgName + " Plugins: " + ps);
}
return (readOrgRepos);
}
use of com.sun.identity.shared.datastruct.OrderedSet in project OpenAM by OpenRock.
the class SMSEntry method searchOrganizationNames.
/**
* Returns the Orgnization Names. Returns a set of organization names. The
* paramter <code>numOfEntries</code> identifies the number of entries to
* return, if <code>0</code> returns all the entries. The paramter
* <code>recursive</code> determines if to return one level of entries
* beneath the entryDN or all the entries till the leaf node.
*/
Set searchOrganizationNames(SSOToken token, int numOfEntries, boolean sortResults, boolean ascendingOrder, String serviceName, String attrName, Set values) throws SMSException, SSOException {
// permission is checked at the server.
if (backendProxyEnabled && !SMSJAXRPCObjectFlg) {
if (isAllowed(token, normalizedDN, readActionSet)) {
if (adminSSOToken == null) {
adminSSOToken = (SSOToken) AccessController.doPrivileged(com.sun.identity.security.AdminTokenAction.getInstance());
}
token = adminSSOToken;
}
} else if (!SMSJAXRPCObjectFlg) {
// Check for delegation permission throws exception if
// permission is denied
getDelegationPermission(token, normalizedDN, readActionSet);
}
Set resultSet = smsObject.searchOrganizationNames(token, dn, numOfEntries, sortResults, ascendingOrder, serviceName, attrName, values);
// Check for remote client using JAX-RPC
if (SMSJAXRPCObjectFlg) {
// parsing would be done at the server
return (resultSet);
}
// Check for read permissions
Set allowedSet = new OrderedSet();
for (Iterator items = resultSet.iterator(); items.hasNext(); ) {
String item = (String) items.next();
if (hasReadPermission(token, item)) {
allowedSet.add(item);
}
}
if (attrName.equalsIgnoreCase(EXPORTEDARGS))
return allowedSet;
Set answer = parseResult(allowedSet, normalizedDN, true);
if (debug.messageEnabled()) {
debug.message("SMSEntry: Successfully obtained " + "organization names for : " + dn);
}
return answer;
}
use of com.sun.identity.shared.datastruct.OrderedSet in project OpenAM by OpenRock.
the class SMSEntry method schemaSubEntries.
Set schemaSubEntries(SSOToken token, String filter, String sidFilter, int numOfEntries, boolean sortResults, boolean ascendingOrder) throws SMSException, SSOException {
// permission is checked at the server.
if (backendProxyEnabled && !SMSJAXRPCObjectFlg) {
if (isAllowed(token, normalizedDN, readActionSet)) {
if (adminSSOToken == null) {
adminSSOToken = (SSOToken) AccessController.doPrivileged(com.sun.identity.security.AdminTokenAction.getInstance());
}
token = adminSSOToken;
}
} else if (!SMSJAXRPCObjectFlg) {
// Check for delegation permission throws exception if
// permission is denied
getDelegationPermission(token, normalizedDN, readActionSet);
}
Set subEntries = smsObject.schemaSubEntries(token, dn, filter, sidFilter, numOfEntries, sortResults, ascendingOrder);
// Check for remote client using JAX-RPC
if (SMSJAXRPCObjectFlg) {
// parsing would be done at the server
return (subEntries);
}
// Need to check if the user has permissions before returning
Set answer = new OrderedSet();
for (Iterator items = subEntries.iterator(); items.hasNext(); ) {
String subEntry = (String) items.next();
if (hasReadPermission(token, "ou=" + subEntry + "," + dn)) {
answer.add(subEntry);
}
}
return (answer);
}
Aggregations