throws Exception
{
final Target target = getTarget(targetName);
// check1ToN(target);
SecurityService securityService = getSecurityServiceConfigBean(target.getConfigTarget().getName());
IdentityAssertionTrust trustConfig =
securityService.getIdentityAssertionTrustById(trustId);
// invalid trustId was specified
if (trustConfig == null)
{
String msg = _strMgr.getString("IdentityTrustDoesntExist", trustId);
throw new MBeanConfigException(msg);
}
TrustedEntity[] entities = trustConfig.getTrustedEntity();
// if its THE only trusted entity element, we might as well
// remove the trust config itself
if (entities.length==1 && entityId.equals(trustConfig.getTrustedEntity(0).getId()))
{
securityService.removeIdentityAssertionTrust(trustConfig);
return true;
}
// get the trusted entity from the trust config and remove
TrustedEntity tEntity = trustConfig.getTrustedEntityById(entityId);
if (tEntity == null)
{
String msg = _strMgr.getString("TrustedEntityDoesntExist", entityId);
throw new MBeanConfigException(msg);
}
trustConfig.removeTrustedEntity(tEntity);
return true;
}