Search in sources :

Example 31 with WSFederationMetaManager

use of com.sun.identity.wsfederation.meta.WSFederationMetaManager in project OpenAM by OpenRock.

the class FSAuthDomainsModelImpl method getAllProviderNames.

/**
     * Returns a <code>Set</code> of provider names that exist in the
     * specified realm.
     *
     * @param realm name of the realm to search.
     * @return a set of provider names.
     * @throws AMConsoleException if provider names cannot be obtained.
     */
public Set getAllProviderNames(String realm) throws AMConsoleException {
    String[] params = { realm };
    logEvent("ATTEMPT_GET_ALL_PROVIDER_NAMES", params);
    Set availableEntities = new HashSet();
    try {
        SAML2MetaManager saml2Mgr = new SAML2MetaManager();
        Set saml2Entities = saml2Mgr.getAllEntities(realm);
        Iterator it = saml2Entities.iterator();
        while (it.hasNext()) {
            String entityId = (String) it.next();
            availableEntities.add(entityId + "|saml2");
        }
    } catch (SAML2MetaException e) {
        String strError = getErrorString(e);
        throw new AMConsoleException(strError);
    }
    try {
        Set wsfedEntities = (new WSFederationMetaManager()).getAllEntities(realm);
        for (Iterator i = wsfedEntities.iterator(); i.hasNext(); ) {
            String tmp = (String) i.next();
            availableEntities.add(tmp + "|wsfed");
        }
    } catch (WSFederationMetaException e) {
        debug.warning("EntityModel.getWSFedEntities", e);
        throw new AMConsoleException(e.getMessage());
    }
    try {
        IDFFMetaManager idffManager = new IDFFMetaManager(null);
        Set entities = idffManager.getAllEntities(realm);
        for (Iterator i = entities.iterator(); i.hasNext(); ) {
            String tmp = (String) i.next();
            availableEntities.add(tmp + "|idff");
        }
    } catch (IDFFMetaException e) {
        debug.warning("FSAuthDomainModel.getAllProviderNames", e);
        throw new AMConsoleException(e.getMessage());
    }
    logEvent("SUCCEED_GET_ALL_PROVIDER_NAMES", params);
    return (availableEntities != null) ? availableEntities : Collections.EMPTY_SET;
}
Also used : WSFederationMetaManager(com.sun.identity.wsfederation.meta.WSFederationMetaManager) Set(java.util.Set) HashSet(java.util.HashSet) IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) Iterator(java.util.Iterator) SAML2MetaManager(com.sun.identity.saml2.meta.SAML2MetaManager) WSFederationMetaException(com.sun.identity.wsfederation.meta.WSFederationMetaException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) SAML2MetaException(com.sun.identity.saml2.meta.SAML2MetaException) HashSet(java.util.HashSet)

Aggregations

WSFederationMetaManager (com.sun.identity.wsfederation.meta.WSFederationMetaManager)31 WSFederationMetaException (com.sun.identity.wsfederation.meta.WSFederationMetaException)20 List (java.util.List)13 FederationElement (com.sun.identity.wsfederation.jaxb.wsfederation.FederationElement)12 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)11 JAXBException (javax.xml.bind.JAXBException)10 Iterator (java.util.Iterator)9 CLIException (com.sun.identity.cli.CLIException)8 ArrayList (java.util.ArrayList)8 WSFederationException (com.sun.identity.wsfederation.common.WSFederationException)7 HashMap (java.util.HashMap)7 SPSSOConfigElement (com.sun.identity.wsfederation.jaxb.entityconfig.SPSSOConfigElement)6 Map (java.util.Map)6 SessionException (com.sun.identity.plugin.session.SessionException)5 Set (java.util.Set)5 BaseConfigType (com.sun.identity.wsfederation.jaxb.entityconfig.BaseConfigType)4 FederationConfigElement (com.sun.identity.wsfederation.jaxb.entityconfig.FederationConfigElement)4 IDPSSOConfigElement (com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement)4 TokenIssuerEndpointElement (com.sun.identity.wsfederation.jaxb.wsfederation.TokenIssuerEndpointElement)4 IOException (java.io.IOException)4