use of com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class IDFFMetaManager method getAllRemoteEntities.
/**
* Returns all remote entities under the realm.
*
* @param realm The realm under which the hosted entities reside.
* @return a <code>List</code> of entity identifiers as Strings.
* @throws IDFFMetaException if unable to retrieve the remote entity
* identifiers.
*/
public List getAllRemoteEntities(String realm) throws IDFFMetaException {
List remoteEntityList = new ArrayList();
try {
Set entityIDs = idffMetaConfigInstance.getAllConfigurationNames(realm);
if (entityIDs != null && !entityIDs.isEmpty()) {
Iterator entityIterator = entityIDs.iterator();
while (entityIterator.hasNext()) {
String entityID = (String) entityIterator.next();
EntityConfigElement entityConfig = getEntityConfig(realm, entityID);
if (entityConfig != null && !entityConfig.isHosted()) {
remoteEntityList.add(entityID);
}
}
}
LogUtil.access(Level.INFO, LogUtil.GET_REMOTE_ENTITIES_SUCCEEDED, null);
} catch (ConfigurationException e) {
debug.error("IDFFMetaManager.getAllRemoteEntities:", e);
LogUtil.error(Level.INFO, LogUtil.GET_REMOTE_ENTITIES_FAILED, null);
throw new IDFFMetaException(e);
}
return remoteEntityList;
}
use of com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class IDFFProviderManager method isNameIDEncryptionEnabled.
/**
* Returns whether the specified provider requires name ID encryption
* or not.
* @param providerID provider ID.
* @return true if the specified provider requires name ID encryption,
* false if it doesn't.
*/
public boolean isNameIDEncryptionEnabled(String providerID) {
EntityConfigElement entityConfig = null;
try {
entityConfig = idffMetaManager.getEntityConfig(ROOT_REALM, providerID);
} catch (IDFFMetaException imex) {
ProviderUtil.debug.error("IDFFProviderManager.isNameIDEncryptionEnabled:", imex);
}
if (entityConfig == null) {
return false;
}
BaseConfigType baseConfig = IDFFMetaUtils.getSPDescriptorConfig(entityConfig);
if (baseConfig == null) {
baseConfig = IDFFMetaUtils.getIDPDescriptorConfig(entityConfig);
if (baseConfig == null) {
return false;
}
}
Map attrMap = IDFFMetaUtils.getAttributes(baseConfig);
if ((attrMap == null) || (attrMap.isEmpty())) {
return false;
}
List values = (List) attrMap.get(IFSConstants.ENABLE_NAMEID_ENCRYPTION);
if ((values == null) || values.isEmpty()) {
return false;
}
return ((String) values.get(0)).equalsIgnoreCase("true");
}
use of com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement 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));
}
}
use of com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class IDFFCOTUtils method removeFromEntityConfig.
/**
* Removes the circle trust name passed from the <code>cotlist</code>
* list attribute in the Entity Config. The Service Provider and Identity
* Provider Entity Configuration are updated.
*
* @param realm realm the entity resides in.
* @param cotName the circle of trust name to be removed.
* @param entityID the entity identifier of the provider.
* @throws IDFFMetaException if there is an error updating the entity
* config.
* @throws JAXBException if there is an error updating the entity config.
*/
public void removeFromEntityConfig(String realm, String cotName, String entityID) throws IDFFMetaException, JAXBException {
String classMethod = "IDFFCOTUtils.removeFromEntityConfig: ";
IDFFMetaManager idffMetaMgr = new IDFFMetaManager(callerSession);
// Check whether the entity id existed in the DS
EntityDescriptorElement entityDesc = idffMetaMgr.getEntityDescriptor(realm, entityID);
if (entityDesc == null) {
debug.error(classMethod + "No such entity: " + entityID);
String[] data = { entityID };
throw new IDFFMetaException("invalidEntityID", data);
}
EntityConfigElement entityConfig = idffMetaMgr.getEntityConfig(realm, entityID);
if (entityConfig != null) {
List spConfigList = entityConfig.getSPDescriptorConfig();
List idpConfigList = entityConfig.getIDPDescriptorConfig();
removeCOTNameFromConfig(realm, spConfigList, cotName, entityConfig, idffMetaMgr);
removeCOTNameFromConfig(realm, idpConfigList, cotName, entityConfig, idffMetaMgr);
BaseConfigType affiConfig = entityConfig.getAffiliationDescriptorConfig();
if (affiConfig != null) {
List affiConfigList = new ArrayList();
affiConfigList.add(affiConfig);
removeCOTNameFromConfig(realm, affiConfigList, cotName, entityConfig, idffMetaMgr);
}
}
}
use of com.sun.identity.federation.jaxb.entityconfig.EntityConfigElement in project OpenAM by OpenRock.
the class IDFFMetaManager method getAllHostedEntities.
/**
* Returns all remote entities under the realm.
*
* @param realm The realm under which the hosted entities reside.
* @return a <code>List</code> of entity identifiers as Strings.
* @throws IDFFMetaException if unable to retrieve the remote entity
* identifiers.
*/
public List getAllHostedEntities(String realm) throws IDFFMetaException {
List hostedEntityList = new ArrayList();
try {
Set entityIDs = idffMetaConfigInstance.getAllConfigurationNames(realm);
if (entityIDs != null && !entityIDs.isEmpty()) {
Iterator entityIterator = entityIDs.iterator();
while (entityIterator.hasNext()) {
String entityID = (String) entityIterator.next();
EntityConfigElement entityConfig = getEntityConfig(realm, entityID);
if (entityConfig != null && entityConfig.isHosted()) {
hostedEntityList.add(entityID);
}
}
}
LogUtil.access(Level.INFO, LogUtil.GET_HOSTED_ENTITIES_SUCCEEDED, null);
} catch (ConfigurationException e) {
debug.error("IDFFMetaManager.getAllHostedEntities:", e);
LogUtil.error(Level.INFO, LogUtil.GET_HOSTED_ENTITIES_FAILED, null);
throw new IDFFMetaException(e);
}
return hostedEntityList;
}
Aggregations