Search in sources :

Example 51 with IDFFMetaException

use of com.sun.identity.federation.meta.IDFFMetaException in project OpenAM by OpenRock.

the class IDFFModelImpl method updateIDPAuthenticationContexts.

/**
     * update IDP Authentication Contexts
     *
     * @param realm Realm of Entity
     * @param entityName Name of Entity Descriptor.     
     * @param cxt IDFFAuthContexts object contains IDP
     *        Authentication Contexts values
     */
public void updateIDPAuthenticationContexts(String realm, String entityName, IDFFAuthContexts cxt) throws AMConsoleException {
    List list = cxt.toIDPAuthContextInfo();
    String[] params = { realm, entityName, "IDFF", "IDP-updateIDPAuthenticationContexts" };
    logEvent("ATTEMPT_MODIFY_ENTITY_DESCRIPTOR", params);
    try {
        IDFFMetaManager idffMetaMgr = getIDFFMetaManager();
        EntityConfigElement entityConfig = idffMetaMgr.getEntityConfig(realm, entityName);
        if (entityConfig == null) {
            throw new AMConsoleException("invalid.entity.name");
        }
        IDPDescriptorConfigElement idpDecConfigElement = idffMetaMgr.getIDPDescriptorConfig(realm, entityName);
        if (idpDecConfigElement == null) {
            throw new AMConsoleException("invalid.config.element");
        } else {
            updateAttrInConfig(idpDecConfigElement, ATTR_IDP_AUTHN_CONTEXT_MAPPING, list);
        }
        //saves the attributes by passing the new entityConfig object
        idffMetaMgr.setEntityConfig(realm, entityConfig);
        logEvent("SUCCEED_MODIFY_ENTITY_DESCRIPTOR", params);
    } catch (IDFFMetaException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { realm, entityName, "IDFF", "IDP-updateIDPAuthenticationContexts", strError };
        logEvent("FEDERATION_EXCEPTION_MODIFY_ENTITY_DESCRIPTOR", paramsEx);
        throw new AMConsoleException(strError);
    }
    return;
}
Also used : IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) ArrayList(java.util.ArrayList) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) IDPDescriptorConfigElement(com.sun.identity.federation.jaxb.entityconfig.IDPDescriptorConfigElement) EntityConfigElement(com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement)

Example 52 with IDFFMetaException

use of com.sun.identity.federation.meta.IDFFMetaException in project OpenAM by OpenRock.

the class IDFFModelImpl method getAffiliateProfileAttributeValues.

/**
     * Returns affiliate profile attribute values.
     *
     * @param realm the realm in which the entity resides.
     * @param entityName name of Entity Descriptor.
     * @return affiliate profile attribute values.
     * @throws AMConsoleException if attribute values cannot be obtained.
     */
public Map getAffiliateProfileAttributeValues(String realm, String entityName) throws AMConsoleException {
    String[] params = { realm, entityName, "IDFF", "IDP" };
    logEvent("ATTEMPT_GET_AFFILIATE_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
    Map values = new HashMap();
    try {
        IDFFMetaManager idffManager = getIDFFMetaManager();
        AffiliationDescriptorType aDesc = (AffiliationDescriptorType) idffManager.getAffiliationDescriptor(realm, entityName);
        if (aDesc != null) {
            values.put(ATTR_AFFILIATE_ID, returnEmptySetIfValueIsNull(aDesc.getAffiliationID()));
            values.put(ATTR_AFFILIATE_OWNER_ID, returnEmptySetIfValueIsNull(aDesc.getAffiliationOwnerID()));
            BaseConfigType affiliationConfig = idffManager.getAffiliationDescriptorConfig(realm, entityName);
            if (affiliationConfig != null) {
                Map map = IDFFMetaUtils.getAttributes(affiliationConfig);
                if (map.containsKey(ATTR_AFFILIATE_SIGNING_CERT_ALIAS)) {
                    values.put(ATTR_AFFILIATE_SIGNING_CERT_ALIAS, returnEmptySetIfValueIsNull(convertListToSet((List) map.get(ATTR_AFFILIATE_SIGNING_CERT_ALIAS))));
                } else {
                    values.put(ATTR_AFFILIATE_SIGNING_CERT_ALIAS, Collections.EMPTY_SET);
                }
                if (map.containsKey(ATTR_AFFILIATE_ENCRYPTION_CERT_ALIAS)) {
                    values.put(ATTR_AFFILIATE_ENCRYPTION_CERT_ALIAS, returnEmptySetIfValueIsNull(convertListToSet((List) map.get(ATTR_AFFILIATE_ENCRYPTION_CERT_ALIAS))));
                } else {
                    values.put(ATTR_AFFILIATE_ENCRYPTION_CERT_ALIAS, Collections.EMPTY_SET);
                }
            }
        } else {
            values.put(ATTR_AFFILIATE_ID, Collections.EMPTY_SET);
            values.put(ATTR_AFFILIATE_OWNER_ID, Collections.EMPTY_SET);
            values.put(ATTR_AFFILIATE_VALID_UNTIL, Collections.EMPTY_SET);
            values.put(ATTR_AFFILIATE_CACHE_DURATION, Collections.EMPTY_SET);
            values.put(ATTR_AFFILIATE_SIGNING_CERT_ALIAS, Collections.EMPTY_SET);
            values.put(ATTR_AFFILIATE_ENCRYPTION_CERT_ALIAS, Collections.EMPTY_SET);
            values.put(ATTR_AFFILIATE_ENCRYPTION_KEY_SIZE, Collections.EMPTY_SET);
            values.put(ATTR_AFFILIATE_ENCRYPTION_KEY_ALGORITHM, Collections.EMPTY_SET);
        }
        logEvent("SUCCEED_GET_AFFILIATE_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
    } catch (IDFFMetaException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { realm, entityName, "IDFF", "SP", strError };
        logEvent("FEDERATION_EXCEPTION_GET_AFFILIATE_ENTITY_DESCRIPTOR_ATTR_VALUES", paramsEx);
        throw new AMConsoleException(strError);
    }
    return (values != null) ? values : Collections.EMPTY_MAP;
}
Also used : BaseConfigType(com.sun.identity.federation.jaxb.entityconfig.BaseConfigType) HashMap(java.util.HashMap) IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) AffiliationDescriptorType(com.sun.identity.liberty.ws.meta.jaxb.AffiliationDescriptorType) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 53 with IDFFMetaException

use of com.sun.identity.federation.meta.IDFFMetaException in project OpenAM by OpenRock.

the class IDFFModelImpl method getIDPAuthenticationContexts.

/**
     * Returns the object of Auththentication Contexts in IDP.
     *
     * @param realm Realm of Entity
     * @param entityName Name of Entity Descriptor.       
     * @return attributes values of provider.
     */
public IDFFAuthContexts getIDPAuthenticationContexts(String realm, String entityName) throws AMConsoleException {
    String str = null;
    IDFFAuthContexts cxt = new IDFFAuthContexts();
    try {
        List tmpList = new ArrayList();
        IDFFMetaManager manager = getIDFFMetaManager();
        Map map = new HashMap();
        BaseConfigType idpConfig = manager.getIDPDescriptorConfig(realm, entityName);
        if (idpConfig != null) {
            map = IDFFMetaUtils.getAttributes(idpConfig);
        } else {
            throw new AMConsoleException("invalid.entity.name");
        }
        List list = (List) map.get(ATTR_IDP_AUTHN_CONTEXT_MAPPING);
        for (int i = 0; i < list.size(); i++) {
            String tmp = (String) list.get(i);
            int index = tmp.lastIndexOf("|");
            String level = removeKey(tmp.substring(index + 1));
            tmp = tmp.substring(0, index);
            index = tmp.lastIndexOf("|");
            String value = removeKey(tmp.substring(index + 1));
            tmp = tmp.substring(0, index);
            index = tmp.indexOf("|");
            String key = removeKey(tmp.substring(index + 1));
            String name = removeKey(tmp.substring(0, index));
            cxt.put(name, "true", key, value, level);
        }
    } catch (IDFFMetaException e) {
        throw new AMConsoleException(getErrorString(e));
    } catch (AMConsoleException e) {
        throw new AMConsoleException(getErrorString(e));
    }
    return (cxt != null) ? cxt : new IDFFAuthContexts();
}
Also used : BaseConfigType(com.sun.identity.federation.jaxb.entityconfig.BaseConfigType) HashMap(java.util.HashMap) IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map) IDFFAuthContexts(com.sun.identity.console.federation.IDFFAuthContexts)

Example 54 with IDFFMetaException

use of com.sun.identity.federation.meta.IDFFMetaException in project OpenAM by OpenRock.

the class ConfigFedMonitoring method getIDFFEntities.

private Map getIDFFEntities(String realm, IDFFMetaManager idffMgr) {
    String classMethod = "ConfigFedMonitoring.getIDFFEntities:";
    Set idffEnts = null;
    // idffentMap: entity name => Map of ("location", "roles") -> values
    // for the IDFF entities
    Map idffentMap = new HashMap();
    try {
        idffEnts = idffMgr.getAllEntities(realm);
        List hosted = idffMgr.getAllHostedEntities(realm);
        for (Iterator it = idffEnts.iterator(); it.hasNext(); ) {
            Map wse = new HashMap();
            String entId = (String) it.next();
            if ((hosted != null) && hosted.contains(entId)) {
                wse.put("location", "hosted");
            } else {
                wse.put("location", "remote");
            }
            wse.put("roles", listToString(getIDFFRoles(entId, realm)));
            idffentMap.put(entId, wse);
        }
    } catch (IDFFMetaException e) {
        debug.error(classMethod + "getting IDFF entity providers for realm " + realm + ": " + e.getMessage());
    }
    return idffentMap;
}
Also used : Set(java.util.Set) HashMap(java.util.HashMap) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Example 55 with IDFFMetaException

use of com.sun.identity.federation.meta.IDFFMetaException in project OpenAM by OpenRock.

the class ConfigFedMonitoring method getAllRealms.

private void getAllRealms(String startRealm) {
    String classMethod = "ConfigFedMonitoring.getAllRealms: ";
    // until IDPs/SPs per realm instrum
    boolean skipSAML2Entities = true;
    StringBuffer sb = new StringBuffer(classMethod);
    sb.append("orgnames starting from ").append(startRealm).append(":\n");
    sb.append("  ").append(startRealm).append("\n");
    List rList = getRealmsList(startRealm);
    try {
        CircleOfTrustManager cotmgr = new CircleOfTrustManager();
        SAML2MetaManager saml2Mgr = new SAML2MetaManager();
        IDFFMetaManager idffmgr = new IDFFMetaManager(ssoToken);
        for (Iterator it = rList.iterator(); it.hasNext(); ) {
            String thisRealm = (String) it.next();
            Set cots = getCOTs(thisRealm, cotmgr);
            Map s2Ents = null;
            if (!skipSAML2Entities) {
                s2Ents = getSAML2Entities(thisRealm, saml2Mgr);
            }
            Map wsEnts = getWSFedEntities(thisRealm);
            Map idffentMap = getIDFFEntities(thisRealm, idffmgr);
            /*
                 *  getCOTMembers(thisRealm, cot, cotmgr, cotsb)
                 *  can get the members of the COT, but there isn't
                 *  a (MIB) entry that right now.
                 */
            Map membMap = getCOTMembers(thisRealm, cots, cotmgr);
            SSOServerRealmFedInfo srfi = new SSOServerRealmFedInfo.SSOServerRealmFedInfoBuilder(thisRealm).cots(cots).samlv2Entities(s2Ents).wsEntities(wsEnts).idffEntities(idffentMap).membEntities(membMap).build();
            Agent.federationConfig(srfi);
        }
    } catch (SAML2MetaException e) {
        debug.error(classMethod + "SAML2 ex: " + e.getMessage());
    } catch (COTException e) {
        debug.error(classMethod + "COT ex: " + e.getMessage());
    } catch (IDFFMetaException e) {
        debug.error(classMethod + "IDFF ex: " + e.getMessage());
    }
}
Also used : CircleOfTrustManager(com.sun.identity.cot.CircleOfTrustManager) Set(java.util.Set) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) SAML2MetaManager(com.sun.identity.saml2.meta.SAML2MetaManager) COTException(com.sun.identity.cot.COTException) IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) SSOServerRealmFedInfo(com.sun.identity.monitoring.SSOServerRealmFedInfo) HashMap(java.util.HashMap) Map(java.util.Map) SAML2MetaException(com.sun.identity.saml2.meta.SAML2MetaException)

Aggregations

IDFFMetaException (com.sun.identity.federation.meta.IDFFMetaException)89 IDFFMetaManager (com.sun.identity.federation.meta.IDFFMetaManager)55 BaseConfigType (com.sun.identity.federation.jaxb.entityconfig.BaseConfigType)30 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)27 Iterator (java.util.Iterator)25 Map (java.util.Map)25 HashMap (java.util.HashMap)24 List (java.util.List)24 ProviderDescriptorType (com.sun.identity.liberty.ws.meta.jaxb.ProviderDescriptorType)22 Set (java.util.Set)21 SAMLException (com.sun.identity.saml.common.SAMLException)17 HashSet (java.util.HashSet)17 ArrayList (java.util.ArrayList)14 FSException (com.sun.identity.federation.common.FSException)13 FSMsgException (com.sun.identity.federation.message.common.FSMsgException)12 CLIException (com.sun.identity.cli.CLIException)10 SessionException (com.sun.identity.plugin.session.SessionException)9 IOException (java.io.IOException)9 IDPDescriptorConfigElement (com.sun.identity.federation.jaxb.entityconfig.IDPDescriptorConfigElement)8 SPDescriptorConfigElement (com.sun.identity.federation.jaxb.entityconfig.SPDescriptorConfigElement)8