Search in sources :

Example 6 with AttributeType

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

the class IDFFModelImpl method addAttributeType.

private BaseConfigType addAttributeType(Map values, BaseConfigType bctype) throws JAXBException {
    ObjectFactory objFactory = new ObjectFactory();
    for (Iterator iter = values.keySet().iterator(); iter.hasNext(); ) {
        AttributeType avp = objFactory.createAttributeElement();
        String key = (String) iter.next();
        avp.setName(key);
        avp.getValue().addAll(Collections.EMPTY_LIST);
        bctype.getAttribute().add(avp);
    }
    return bctype;
}
Also used : ObjectFactory(com.sun.identity.federation.jaxb.entityconfig.ObjectFactory) AttributeType(com.sun.identity.federation.jaxb.entityconfig.AttributeType) Iterator(java.util.Iterator)

Example 7 with AttributeType

use of com.sun.identity.federation.jaxb.entityconfig.AttributeType 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

AttributeType (com.sun.identity.federation.jaxb.entityconfig.AttributeType)7 Iterator (java.util.Iterator)6 List (java.util.List)5 BaseConfigType (com.sun.identity.federation.jaxb.entityconfig.BaseConfigType)4 ObjectFactory (com.sun.identity.federation.jaxb.entityconfig.ObjectFactory)4 ArrayList (java.util.ArrayList)3 EntityConfigElement (com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement)2 EntityDescriptorElement (com.sun.identity.liberty.ws.meta.jaxb.EntityDescriptorElement)2 JAXBException (javax.xml.bind.JAXBException)2 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)1 IDFFMetaException (com.sun.identity.federation.meta.IDFFMetaException)1 IDFFMetaManager (com.sun.identity.federation.meta.IDFFMetaManager)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1