Esempio n. 1
0
 /**
  * Updates the entity config to update the values of the <code>cotlist</code> attribute.
  *
  * @param realm realm the entity resides in.
  * @param configList the list containing config elements.
  * @param cotName the circle of trust name.
  * @param entityConfig the <code>EntityConfigElement</code> object
  * @param objFactory the object factory object
  * @param idffMetaMgr the <code>IDFFMetaManager</code> object.
  * @throws <code>IDFFMetaException</code> if there is an error retrieving and updating the
  *     entityConfig.
  * @throws <code>JAXBException</code> if there is an error setting the config.
  */
 private void updateCOTAttrInConfig(
     String realm,
     List configList,
     String cotName,
     EntityConfigElement entityConfig,
     ObjectFactory objFactory,
     IDFFMetaManager idffMetaMgr)
     throws IDFFMetaException, JAXBException {
   boolean foundCOT = false;
   for (Iterator iter = configList.iterator(); iter.hasNext(); ) {
     BaseConfigType bConfig = (BaseConfigType) iter.next();
     List list = bConfig.getAttribute();
     for (Iterator iter2 = list.iterator(); iter2.hasNext(); ) {
       AttributeType avp = (AttributeType) iter2.next();
       if (avp.getName().trim().equalsIgnoreCase(COT_LIST)) {
         foundCOT = true;
         List avpl = avp.getValue();
         if (avpl.isEmpty() || !containsValue(avpl, cotName)) {
           avpl.add(cotName);
           idffMetaMgr.setEntityConfig(realm, entityConfig);
           break;
         }
       }
     }
     // no cot_list in the original entity config
     if (!foundCOT) {
       AttributeType atype = objFactory.createAttributeType();
       atype.setName(COT_LIST);
       atype.getValue().add(cotName);
       list.add(atype);
       idffMetaMgr.setEntityConfig(realm, entityConfig);
     }
   }
 }
Esempio n. 2
0
 /**
  * Iterates through a list of entity config elements and removes the circle trust name from the
  * entity config.
  */
 private void removeCOTNameFromConfig(
     String realm,
     List configList,
     String cotName,
     EntityConfigElement entityConfig,
     IDFFMetaManager idffMetaMgr)
     throws IDFFMetaException {
   for (Iterator iter = configList.iterator(); iter.hasNext(); ) {
     BaseConfigType bConfig = (BaseConfigType) iter.next();
     List list = bConfig.getAttribute();
     for (Iterator iter2 = list.iterator(); iter2.hasNext(); ) {
       AttributeType avp = (AttributeType) iter2.next();
       if (avp.getName().trim().equalsIgnoreCase(COT_LIST)) {
         List avpl = avp.getValue();
         if (avpl != null && !avpl.isEmpty() && containsValue(avpl, cotName)) {
           avpl.remove(cotName);
           idffMetaMgr.setEntityConfig(realm, entityConfig);
           break;
         }
       }
     }
   }
 }