Search in sources :

Example 16 with IDPDescriptorConfigElement

use of com.sun.identity.federation.jaxb.entityconfig.IDPDescriptorConfigElement in project OpenAM by OpenRock.

the class IDFFSingleLogoutHandler method findIDPMetaAlias.

/**
     * Returns the IDFF IDP metaAlis which is in the same COT as the initiation
     * IDP and SP. Return null if such IDFF IDP does not exist or exception
     * occurs.
     */
private String findIDPMetaAlias(String idpEntityID, String spEntityID, String realm, String protocol) {
    try {
        IDFFMetaManager idffManager = new IDFFMetaManager(null);
        List hostedIdps = idffManager.getAllHostedIdentityProviderIDs(realm);
        if ((hostedIdps == null) || hostedIdps.isEmpty()) {
            return null;
        }
        CircleOfTrustManager cotManager = new CircleOfTrustManager();
        Set cots = cotManager.getAllActiveCirclesOfTrust(realm);
        int num = hostedIdps.size();
        for (int i = 0; i < num; i++) {
            String idpId = (String) hostedIdps.get(i);
            Iterator it = cots.iterator();
            while (it.hasNext()) {
                String cotName = (String) it.next();
                // check if this cot contains all entities
                Set providers = cotManager.listCircleOfTrustMember(realm, cotName, SingleLogoutManager.IDFF);
                if ((providers == null) || !providers.contains(idpId)) {
                    continue;
                }
                providers = cotManager.listCircleOfTrustMember(realm, cotName, protocol);
                if ((providers == null) || !providers.contains(idpEntityID)) {
                    continue;
                }
                if ((spEntityID != null) && !providers.contains(spEntityID)) {
                    continue;
                }
                // but just stop here right now.
                if (SingleLogoutManager.debug.messageEnabled()) {
                    SingleLogoutManager.debug.message("IDFFSingleLogoutHandler.findIDPMetaAlias : " + "found IDP " + idpId + " in COT " + cotName);
                }
                IDPDescriptorConfigElement config = idffManager.getIDPDescriptorConfig(realm, idpId);
                return config.getMetaAlias();
            }
        }
    } catch (Exception e) {
        SingleLogoutManager.debug.error("IDFFSingleLogoutHandler." + "findIDPMetaAlias", e);
    }
    return null;
}
Also used : CircleOfTrustManager(com.sun.identity.cot.CircleOfTrustManager) Set(java.util.Set) IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) Iterator(java.util.Iterator) List(java.util.List) IDPDescriptorConfigElement(com.sun.identity.federation.jaxb.entityconfig.IDPDescriptorConfigElement)

Aggregations

IDPDescriptorConfigElement (com.sun.identity.federation.jaxb.entityconfig.IDPDescriptorConfigElement)16 SPDescriptorConfigElement (com.sun.identity.federation.jaxb.entityconfig.SPDescriptorConfigElement)8 IDFFMetaException (com.sun.identity.federation.meta.IDFFMetaException)8 IDFFMetaManager (com.sun.identity.federation.meta.IDFFMetaManager)8 Iterator (java.util.Iterator)6 List (java.util.List)5 Map (java.util.Map)4 Set (java.util.Set)4 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)3 EntityConfigElement (com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement)3 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 CLIException (com.sun.identity.cli.CLIException)2 CircleOfTrustManager (com.sun.identity.cot.CircleOfTrustManager)2 ConfigurationException (com.sun.identity.plugin.configuration.ConfigurationException)2 Attribute (com.sun.identity.saml.assertion.Attribute)2 AttributeStatement (com.sun.identity.saml.assertion.AttributeStatement)2 SAMLException (com.sun.identity.saml.common.SAMLException)2 HashMap (java.util.HashMap)2 COTException (com.sun.identity.cot.COTException)1