Search in sources :

Example 51 with BaseConfigType

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

the class LibertyManager method getList.

/**
     * The steps for getting the <code>IDPList</code> and <code>SPList</code>
     * are the same (except for a role check). So having this private method
     * which takes in role and does the required function.
     */
private static Iterator getList(String realm, String entityID, String providerRole, String remoteProviderRole) {
    Set trustedProviders = null;
    BaseConfigType providerConfig = IDFFMetaUtils.getExtendedConfig(realm, entityID, providerRole, metaManager);
    if (providerConfig != null) {
        trustedProviders = metaManager.getAllTrustedProviders(providerConfig.getMetaAlias());
    }
    if (trustedProviders == null) {
        trustedProviders = new HashSet();
    }
    return trustedProviders.iterator();
}
Also used : BaseConfigType(com.sun.identity.federation.jaxb.entityconfig.BaseConfigType) HashSet(java.util.HashSet) Set(java.util.Set) HashSet(java.util.HashSet)

Example 52 with BaseConfigType

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

the class LibertyManager method getFederationDonePageURL.

/** 
     * Returns the <code>FederationDonePageURL</code> from the provider ID
     * under a realm.
     *
     * @param realm The realm under which the entity resides.
     * @param providerID Provider's entity ID.
     * @param providerRole Provider Role.
     * @param request HTTP servlet request.
     * @return the <code>FederationDonePageURL</code> from the provider ID.
     * @deprecated This method is deprecated.
     * @see #getFederationDonePageURL(String,String,String,HttpServletRequest)
     */
public static String getFederationDonePageURL(String realm, String providerID, String providerRole, HttpServletRequest request) {
    BaseConfigType providerConfig = IDFFMetaUtils.getExtendedConfig(realm, providerID, providerRole, metaManager);
    String metaAlias = null;
    if (providerConfig != null) {
        metaAlias = providerConfig.getMetaAlias();
    }
    return FSServiceUtils.getFederationDonePageURL(request, providerConfig, metaAlias);
}
Also used : BaseConfigType(com.sun.identity.federation.jaxb.entityconfig.BaseConfigType)

Example 53 with BaseConfigType

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

the class IDFFModelImpl method getIDPEntityConfig.

/**
     * Returns attributes values in extended metadata.
     *
     * @param realm where the entity exists.
     * @param entityName Name of Entity Descriptor.
     * @param location Location of provider such as Hosted or Remote.
     * @return attributes values of provider.
     */
public Map getIDPEntityConfig(String realm, String entityName, String location) throws AMConsoleException {
    String[] params = { realm, entityName, "IDFF", "IDP-Extended Metadata" };
    logEvent("ATTEMPT_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
    IDFFMetaManager manager;
    Map map = new HashMap();
    Map tmpMap = new HashMap();
    try {
        manager = getIDFFMetaManager();
        String metaAlias = null;
        BaseConfigType idpConfig = manager.getIDPDescriptorConfig(realm, entityName);
        if (idpConfig != null) {
            map = IDFFMetaUtils.getAttributes(idpConfig);
            metaAlias = idpConfig.getMetaAlias();
        } else {
            createEntityConfig(realm, entityName, IFSConstants.IDP, location);
        }
        Set entries = map.entrySet();
        Iterator iterator = entries.iterator();
        while (iterator.hasNext()) {
            Map.Entry entry = (Map.Entry) iterator.next();
            tmpMap.put((String) entry.getKey(), returnEmptySetIfValueIsNull(convertListToSet((List) entry.getValue())));
        }
        tmpMap.put(ATTR_PROVIDER_ALIAS, returnEmptySetIfValueIsNull(metaAlias));
        if (!tmpMap.containsKey(ATTR_SIGNING_CERT_ALIAS)) {
            tmpMap.put(ATTR_SIGNING_CERT_ALIAS, Collections.EMPTY_SET);
        }
        if (!tmpMap.containsKey(ATTR_ENCRYPTION_CERT_ALIAS)) {
            tmpMap.put(ATTR_ENCRYPTION_CERT_ALIAS, Collections.EMPTY_SET);
        }
        logEvent("SUCCEED_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
    } catch (IDFFMetaException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { realm, entityName, "IDFF", "IDP-Extended Metadata", strError };
        logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", paramsEx);
        throw new AMConsoleException(getErrorString(e));
    } catch (AMConsoleException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { realm, entityName, "IDFF", "IDP-Extended Metadata", strError };
        logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", paramsEx);
        throw new AMConsoleException(getErrorString(e));
    }
    return tmpMap;
}
Also used : BaseConfigType(com.sun.identity.federation.jaxb.entityconfig.BaseConfigType) HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) Iterator(java.util.Iterator) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 54 with BaseConfigType

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

the class IDFFModelImpl method createEntityConfig.

public void createEntityConfig(String realm, String entityName, String role, String location) throws AMConsoleException {
    try {
        IDFFMetaManager idffMetaMgr = getIDFFMetaManager();
        ObjectFactory objFactory = new ObjectFactory();
        // Check whether the entity id existed in the DS
        EntityDescriptorElement entityDesc = idffMetaMgr.getEntityDescriptor(realm, entityName);
        if (entityDesc == null) {
            throw new AMConsoleException("invalid.entity.name");
        }
        EntityConfigElement entityConfig = idffMetaMgr.getEntityConfig(realm, entityName);
        if (entityConfig == null) {
            entityConfig = objFactory.createEntityConfigElement();
            // add to entityConfig
            entityConfig.setEntityID(entityName);
            if (location.equals("remote")) {
                entityConfig.setHosted(false);
            } else {
                entityConfig.setHosted(true);
            }
        }
        // create entity config and add the attribute
        BaseConfigType baseCfgType = null;
        // It could have one sp and one idp.
        if ((role.equals(IFSConstants.SP)) && (IDFFMetaUtils.getSPDescriptor(entityDesc) != null)) {
            baseCfgType = objFactory.createSPDescriptorConfigElement();
            for (Iterator iter = extendedMetaMap.keySet().iterator(); iter.hasNext(); ) {
                AttributeType atype = objFactory.createAttributeType();
                String key = (String) iter.next();
                atype.setName(key);
                atype.getValue().addAll(Collections.EMPTY_LIST);
                baseCfgType.getAttribute().add(atype);
            }
            for (Iterator iter = extendedMetaSpMap.keySet().iterator(); iter.hasNext(); ) {
                AttributeType atype = objFactory.createAttributeType();
                String key = (String) iter.next();
                atype.setName(key);
                atype.getValue().addAll(Collections.EMPTY_LIST);
                baseCfgType.getAttribute().add(atype);
            }
            entityConfig.getSPDescriptorConfig().add(baseCfgType);
        } else if ((role.equals(IFSConstants.IDP)) && (IDFFMetaUtils.getIDPDescriptor(entityDesc) != null)) {
            baseCfgType = objFactory.createIDPDescriptorConfigElement();
            for (Iterator iter = extendedMetaMap.keySet().iterator(); iter.hasNext(); ) {
                AttributeType atype = objFactory.createAttributeType();
                String key = (String) iter.next();
                atype.setName(key);
                atype.getValue().addAll(Collections.EMPTY_LIST);
                baseCfgType.getAttribute().add(atype);
            }
            for (Iterator iter = extendedMetaIdpMap.keySet().iterator(); iter.hasNext(); ) {
                AttributeType atype = objFactory.createAttributeType();
                String key = (String) iter.next();
                atype.setName(key);
                atype.getValue().addAll(Collections.EMPTY_LIST);
                baseCfgType.getAttribute().add(atype);
            }
            entityConfig.getIDPDescriptorConfig().add(baseCfgType);
        }
        idffMetaMgr.setEntityConfig(realm, entityConfig);
    } catch (IDFFMetaException e) {
        throw new AMConsoleException(getErrorString(e));
    } catch (JAXBException e) {
        throw new AMConsoleException(getErrorString(e));
    }
}
Also used : BaseConfigType(com.sun.identity.federation.jaxb.entityconfig.BaseConfigType) ObjectFactory(com.sun.identity.federation.jaxb.entityconfig.ObjectFactory) IDFFMetaManager(com.sun.identity.federation.meta.IDFFMetaManager) AttributeType(com.sun.identity.federation.jaxb.entityconfig.AttributeType) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException) JAXBException(javax.xml.bind.JAXBException) Iterator(java.util.Iterator) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) EntityDescriptorElement(com.sun.identity.liberty.ws.meta.jaxb.EntityDescriptorElement) EntityConfigElement(com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement)

Aggregations

BaseConfigType (com.sun.identity.federation.jaxb.entityconfig.BaseConfigType)54 IDFFMetaException (com.sun.identity.federation.meta.IDFFMetaException)33 IDFFMetaManager (com.sun.identity.federation.meta.IDFFMetaManager)18 List (java.util.List)18 FSException (com.sun.identity.federation.common.FSException)17 SessionException (com.sun.identity.plugin.session.SessionException)14 IOException (java.io.IOException)14 ArrayList (java.util.ArrayList)14 Iterator (java.util.Iterator)14 IDPDescriptorType (com.sun.identity.liberty.ws.meta.jaxb.IDPDescriptorType)13 SAMLException (com.sun.identity.saml.common.SAMLException)13 FSMsgException (com.sun.identity.federation.message.common.FSMsgException)12 ProviderDescriptorType (com.sun.identity.liberty.ws.meta.jaxb.ProviderDescriptorType)12 FSSessionManager (com.sun.identity.federation.services.FSSessionManager)10 HashMap (java.util.HashMap)10 Map (java.util.Map)10 ServletException (javax.servlet.ServletException)10 FSAuthnRequest (com.sun.identity.federation.message.FSAuthnRequest)9 Set (java.util.Set)9 FSAccountMgmtException (com.sun.identity.federation.accountmgmt.FSAccountMgmtException)8