Search in sources :

Example 6 with OrderedSet

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));
    }
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) Map(java.util.Map)

Example 7 with OrderedSet

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);
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) HashSet(java.util.HashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) IdRepo(com.sun.identity.idm.IdRepo) Iterator(java.util.Iterator) HashSet(java.util.HashSet)

Example 8 with OrderedSet

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);
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) HashSet(java.util.HashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) SMSException(com.sun.identity.sm.SMSException) IdRepoException(com.sun.identity.idm.IdRepoException) LinkedHashMap(java.util.LinkedHashMap) IdRepo(com.sun.identity.idm.IdRepo) ServiceConfig(com.sun.identity.sm.ServiceConfig) Iterator(java.util.Iterator) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) HashSet(java.util.HashSet)

Example 9 with OrderedSet

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;
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) CaseInsensitiveHashSet(com.sun.identity.common.CaseInsensitiveHashSet) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) Iterator(java.util.Iterator)

Example 10 with OrderedSet

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);
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) CaseInsensitiveHashSet(com.sun.identity.common.CaseInsensitiveHashSet) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) Iterator(java.util.Iterator)

Aggregations

OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)87 Map (java.util.Map)52 Set (java.util.Set)36 Iterator (java.util.Iterator)20 HashMap (java.util.HashMap)17 HashSet (java.util.HashSet)16 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)13 CCActionTableModel (com.sun.web.ui.model.CCActionTableModel)13 CCActionTable (com.sun.web.ui.view.table.CCActionTable)12 AMServiceProfileModel (com.sun.identity.console.base.model.AMServiceProfileModel)6 CaseInsensitiveHashSet (com.sun.identity.common.CaseInsensitiveHashSet)5 ArrayList (java.util.ArrayList)5 LinkedHashSet (java.util.LinkedHashSet)5 SMDiscoveryServiceData (com.sun.identity.console.service.model.SMDiscoveryServiceData)4 List (java.util.List)4 AuthPropertiesModel (com.sun.identity.console.authentication.model.AuthPropertiesModel)3 WSAuthHandlerEntry (com.sun.identity.console.webservices.model.WSAuthHandlerEntry)3 IdRepo (com.sun.identity.idm.IdRepo)3 Issuer (com.sun.identity.saml2.assertion.Issuer)3 SAML2Exception (com.sun.identity.saml2.common.SAML2Exception)3