Search in sources :

Example 1 with AMConsoleException

use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.

the class AgentsModelImpl method createAgentGroup.

/**
     * Creates agent group.
     *
     * @param realmName Realm where agent group resides.
     * @param name Name of agent group.
     * @param type Type of agent group.
     * @throws AMConsoleException if agent group cannot be created.
     */
public void createAgentGroup(String realmName, String name, String type) throws AMConsoleException {
    String[] params = { realmName, name, type };
    try {
        logEvent("ATTEMPT_CREATE_AGENT_GROUP", params);
        AgentConfiguration.createAgentGroup(getUserSSOToken(), realmName, name, type, AgentConfiguration.getDefaultValues(type, true));
        logEvent("SUCCEED_CREATE_AGENT_GROUP", params);
    } catch (ConfigurationException e) {
        String[] paramsEx = { realmName, name, type, getErrorString(e) };
        logEvent("EXCEPTION_CREATE_AGENT_GROUP", paramsEx);
        debug.warning("AgentsModelImpl.createAgentGroup", e);
        throw new AMConsoleException(getErrorString(e));
    } catch (SSOException e) {
        String[] paramsEx = { realmName, name, type, getErrorString(e) };
        logEvent("EXCEPTION_CREATE_AGENT_GROUP", paramsEx);
        debug.warning("AgentsModelImpl.createAgentGroup", e);
        throw new AMConsoleException(getErrorString(e));
    } catch (IdRepoException e) {
        String[] paramsEx = { realmName, name, type, getErrorString(e) };
        logEvent("EXCEPTION_CREATE_AGENT_GROUP", paramsEx);
        debug.warning("AgentsModelImpl.createAgentGroup", e);
        throw new AMConsoleException(getErrorString(e));
    } catch (SMSException e) {
        String[] paramsEx = { realmName, name, type, getErrorString(e) };
        logEvent("EXCEPTION_CREATE_AGENT_GROUP", paramsEx);
        debug.warning("AgentsModelImpl.createAgentGroup", e);
        throw new AMConsoleException(getErrorString(e));
    }
}
Also used : ConfigurationException(com.sun.identity.common.configuration.ConfigurationException) SMSException(com.sun.identity.sm.SMSException) IdRepoException(com.sun.identity.idm.IdRepoException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 2 with AMConsoleException

use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.

the class WSFedGeneralViewBean method setDisplayName.

private void setDisplayName(String entityName, String realm) {
    WSFedPropertiesModel model = (WSFedPropertiesModel) getModel();
    Map spmap = new HashMap();
    Map idpmap = new HashMap();
    try {
        // retrieve role of entity
        List roleList = getWSFedRoles(entityName, realm);
        Iterator rIt = roleList.listIterator();
        // to display idp and sp display names in case of a dual entity
        if (roleList.size() > 1) {
            spmap = model.getServiceProviderAttributes(realm, entityName);
            idpmap = model.getIdentityProviderAttributes(realm, entityName);
            setDisplayFieldValue(WSFedPropertiesModel.TF_DISPNAME, getDisplayName(spmap));
            setDisplayFieldValue(WSFedPropertiesModel.TFIDPDISP_NAME, getDisplayName(idpmap));
        } else {
            // to show display name for an entity with single role
            while (rIt.hasNext()) {
                String role = (String) rIt.next();
                if (role.equals(EntityModel.SERVICE_PROVIDER)) {
                    spmap = model.getServiceProviderAttributes(realm, entityName);
                    setDisplayFieldValue(WSFedPropertiesModel.TF_DISPNAME, getDisplayName(spmap));
                } else if (role.equals(EntityModel.IDENTITY_PROVIDER)) {
                    idpmap = model.getIdentityProviderAttributes(realm, entityName);
                    setDisplayFieldValue(WSFedPropertiesModel.TF_DISPNAME, getDisplayName(idpmap));
                }
            }
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "error in setting Display Name ");
    }
}
Also used : WSFedPropertiesModel(com.sun.identity.console.federation.model.WSFedPropertiesModel) HashMap(java.util.HashMap) Iterator(java.util.Iterator) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 3 with AMConsoleException

use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.

the class PolicyCache method getPolicy.

/**
     * Returns cached policy object
     *
     * @param token single sign on token
     * @param cacheID Key for retrieve this policy
     * @return policy Policy object.
     * @throws AMConsoleException if policy object cannot be located.
     */
public CachedPolicy getPolicy(SSOToken token, String cacheID) throws AMConsoleException {
    CachedPolicy policy = null;
    String key = token.getTokenID().toString();
    Map map = (Map) mapTokenIDs.get(key);
    if (map != null) {
        policy = (CachedPolicy) map.get(cacheID);
    }
    if (policy == null) {
        throw new AMConsoleException("Cannot locate cached policy " + cacheID);
    }
    return policy;
}
Also used : AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) HashMap(java.util.HashMap)

Example 4 with AMConsoleException

use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.

the class PolicyModelImpl method getDisplayNameForSubjectValues.

/**
     * Returns a map of values to localized label.
     *
     * @param realmName Name of realm.
     * @param subjectTypeName Name of Subject Type.
     * @param values Valid values.
     * @return a map of values to localized label.
     */
public Map getDisplayNameForSubjectValues(String realmName, String subjectTypeName, Set values) {
    Map map = null;
    if ((values != null) && !values.isEmpty()) {
        map = new HashMap(values.size() * 2);
        Locale locale = getUserLocale();
        try {
            PolicyManager policyMgr = getPolicyManager(realmName);
            if (policyMgr != null) {
                SubjectTypeManager subjectTypeMgr = policyMgr.getSubjectTypeManager();
                Subject subject = subjectTypeMgr.getSubject(subjectTypeName);
                for (Iterator i = values.iterator(); i.hasNext(); ) {
                    String v = (String) i.next();
                    map.put(v, subject.getDisplayNameForValue(v, locale));
                }
            }
        } catch (AMConsoleException e) {
            debug.warning("PolicyModelImpl.getDisplayNameForSubjectValues", e);
        } catch (NameNotFoundException e) {
            debug.warning("PolicyModelImpl.getDisplayNameForSubjectValues", e);
        } catch (PolicyException e) {
            debug.warning("PolicyModelImpl.getDisplayNameForSubjectValues", e);
        }
    }
    return (map == null) ? Collections.EMPTY_MAP : map;
}
Also used : Locale(java.util.Locale) PolicyManager(com.sun.identity.policy.PolicyManager) SubjectTypeManager(com.sun.identity.policy.SubjectTypeManager) HashMap(java.util.HashMap) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) PolicyException(com.sun.identity.policy.PolicyException) Iterator(java.util.Iterator) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) HashMap(java.util.HashMap) Subject(com.sun.identity.policy.interfaces.Subject)

Example 5 with AMConsoleException

use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.

the class IdentitySubjectModelImpl method getEntityNames.

/**
     * Returns entity names.
     *
     * @param pattern Search Pattern.
     * @param strType Entity Type.
     * @param realmName Name of Realm.
     */
public IdSearchResults getEntityNames(String realmName, String strType, String pattern) throws AMConsoleException {
    if (realmName == null) {
        realmName = "/";
    }
    if ((pattern == null) || (pattern.trim().length() == 0)) {
        pattern = "*";
    }
    int sizeLimit = getSearchResultLimit();
    int timeLimit = getSearchTimeOutLimit();
    String[] params = { realmName, strType, pattern, Integer.toString(sizeLimit), Integer.toString(timeLimit) };
    try {
        AMIdentityRepository repo = new AMIdentityRepository(getUserSSOToken(), realmName);
        IdType type = IdUtils.getType(strType);
        IdSearchControl idsc = new IdSearchControl();
        idsc.setRecursive(true);
        idsc.setMaxResults(sizeLimit);
        idsc.setTimeOut(timeLimit);
        logEvent("ATTEMPT_SEARCH_IDENTITY", params);
        IdSearchResults results = repo.searchIdentities(type, pattern, idsc);
        logEvent("SUCCEED_SEARCH_IDENTITY", params);
        return results;
    } catch (IdRepoException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { realmName, strType, pattern, Integer.toString(sizeLimit), Integer.toString(timeLimit), strError };
        logEvent("IDM_EXCEPTION_SEARCH_IDENTITY", paramsEx);
        throw new AMConsoleException(strError);
    } catch (SSOException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { realmName, strType, pattern, Integer.toString(sizeLimit), Integer.toString(timeLimit), strError };
        logEvent("SSO_EXCEPTION_SEARCH_IDENTITY", paramsEx);
        throw new AMConsoleException(strError);
    }
}
Also used : IdSearchResults(com.sun.identity.idm.IdSearchResults) AMIdentityRepository(com.sun.identity.idm.AMIdentityRepository) IdSearchControl(com.sun.identity.idm.IdSearchControl) IdRepoException(com.sun.identity.idm.IdRepoException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) IdType(com.sun.identity.idm.IdType)

Aggregations

AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)701 Map (java.util.Map)255 Set (java.util.Set)206 HashMap (java.util.HashMap)193 HashSet (java.util.HashSet)148 SSOException (com.iplanet.sso.SSOException)126 Iterator (java.util.Iterator)122 List (java.util.List)97 SMSException (com.sun.identity.sm.SMSException)83 ArrayList (java.util.ArrayList)78 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)76 IdRepoException (com.sun.identity.idm.IdRepoException)58 SAML2MetaException (com.sun.identity.saml2.meta.SAML2MetaException)47 SAML2MetaManager (com.sun.identity.saml2.meta.SAML2MetaManager)46 AMIdentity (com.sun.identity.idm.AMIdentity)44 SAMLv2Model (com.sun.identity.console.federation.model.SAMLv2Model)41 NameNotFoundException (com.sun.identity.policy.NameNotFoundException)41 CCActionTable (com.sun.web.ui.view.table.CCActionTable)40 TreeSet (java.util.TreeSet)39 CachedPolicy (com.sun.identity.console.policy.model.CachedPolicy)38