use of com.sun.identity.wsfederation.jaxb.entityconfig.FederationConfigElement in project OpenAM by OpenRock.
the class WSFederationCOTUtils method removeFromEntityConfig.
/**
* Removes the circle of trust name passed from the <code>cotlist</code>
* attribute in the Entity Config. The Service Provider and Identity
* Provider Entity Configuration are updated.
*
* @param realm the realm of the provider
* @param name the circle of trust name to be removed.
* @param entityId the entity identifier of the provider.
* @throws WSFederationMetaException 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 name, String entityId) throws WSFederationMetaException, JAXBException {
String classMethod = "WSFederationCOTUtils.removeFromEntityConfig: ";
WSFederationMetaManager metaManager = null;
if (callerSession != null) {
metaManager = new WSFederationMetaManager(callerSession);
} else {
metaManager = new WSFederationMetaManager();
}
// Check whether the entity id existed in the DS
FederationElement edes = metaManager.getEntityDescriptor(realm, entityId);
if (edes == null) {
debug.error(classMethod + "No such entity: " + entityId);
String[] data = { realm, entityId };
throw new WSFederationMetaException("entityid_invalid", data);
}
FederationConfigElement eConfig = metaManager.getEntityConfig(realm, entityId);
if (eConfig != null) {
List elist = eConfig.getIDPSSOConfigOrSPSSOConfig();
for (Iterator iter = elist.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(SAML2Constants.COT_LIST)) {
List avpl = avp.getValue();
if (avpl != null && !avpl.isEmpty() && containsValue(avpl, name)) {
avpl.remove(name);
metaManager.setEntityConfig(realm, eConfig);
break;
}
}
}
}
}
}
use of com.sun.identity.wsfederation.jaxb.entityconfig.FederationConfigElement in project OpenAM by OpenRock.
the class WSFederationMetaManager 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 ID <code>String</code>.
* @throws WSFederationMetaException if unable to retrieve the entity ids.
*/
public List<String> getAllRemoteEntities(String realm) throws WSFederationMetaException {
List<String> remoteEntityIds = new ArrayList();
String[] objs = { realm };
try {
Set entityIds = configInst.getAllConfigurationNames(realm);
if (entityIds != null && !entityIds.isEmpty()) {
for (Iterator iter = entityIds.iterator(); iter.hasNext(); ) {
String federationId = (String) iter.next();
FederationConfigElement config = getEntityConfig(realm, federationId);
if (config == null || !config.isHosted()) {
remoteEntityIds.add(federationId);
}
}
}
} catch (ConfigurationException e) {
debug.error("WSFederationMetaManager.getAllRemoteEntities:", e);
String[] data = { e.getMessage(), realm };
LogUtil.error(Level.INFO, LogUtil.CONFIG_ERROR_GET_ALL_REMOTE_ENTITIES, data, null);
throw new WSFederationMetaException(e);
}
LogUtil.access(Level.FINE, LogUtil.GOT_ALL_REMOTE_ENTITIES, objs, null);
return remoteEntityIds;
}
use of com.sun.identity.wsfederation.jaxb.entityconfig.FederationConfigElement in project OpenAM by OpenRock.
the class WSFederationMetaManager method getAllHostedEntities.
/**
* Returns all hosted entities under the realm.
*
* @param realm The realm under which the hosted entities reside.
* @return a <code>List</code> of entity ID <code>String</code>.
* @throws WSFederationMetaException if unable to retrieve the entity ids.
*/
public List<String> getAllHostedEntities(String realm) throws WSFederationMetaException {
List<String> hostedEntityIds = new ArrayList<String>();
try {
Set entityIds = configInst.getAllConfigurationNames(realm);
if (entityIds != null && !entityIds.isEmpty()) {
for (Iterator iter = entityIds.iterator(); iter.hasNext(); ) {
String federationId = (String) iter.next();
FederationConfigElement config = getEntityConfig(realm, federationId);
if (config != null && config.isHosted()) {
hostedEntityIds.add(federationId);
}
}
}
} catch (ConfigurationException e) {
debug.error("WSFederationMetaManager.getAllHostedEntities:", e);
String[] data = { e.getMessage(), realm };
LogUtil.error(Level.INFO, LogUtil.CONFIG_ERROR_GET_ALL_HOSTED_ENTITIES, data, null);
throw new WSFederationMetaException(e);
}
String[] objs = { realm };
LogUtil.access(Level.FINE, LogUtil.GOT_ALL_HOSTED_ENTITIES, objs, null);
return hostedEntityIds;
}
use of com.sun.identity.wsfederation.jaxb.entityconfig.FederationConfigElement in project OpenAM by OpenRock.
the class WSFederationMetaManager method getAllHostedMetaAliasesByRealm.
/**
* Returns all the hosted entity metaAliases for a realm.
*
* @param realm The given realm.
* @return all the hosted entity metaAliases for a realm or an empty arrayList if not found.
* @throws WSFederationMetaException if unable to retrieve the entity ids.
*/
public List<String> getAllHostedMetaAliasesByRealm(String realm) throws WSFederationMetaException {
List<String> metaAliases = new ArrayList<String>();
try {
Set<String> entityIds = configInst.getAllConfigurationNames(realm);
if (entityIds == null || entityIds.isEmpty()) {
return metaAliases;
}
for (String entityId : entityIds) {
FederationConfigElement config = getEntityConfig(realm, entityId);
if (config == null || !config.isHosted()) {
continue;
}
List<BaseConfigType> configList = config.getIDPSSOConfigOrSPSSOConfig();
for (BaseConfigType bConfigType : configList) {
String curMetaAlias = bConfigType.getMetaAlias();
if (curMetaAlias != null && !curMetaAlias.isEmpty()) {
metaAliases.add(curMetaAlias);
}
}
}
} catch (ConfigurationException e) {
debug.error("WSFederationMetaManager.getAllHostedMetaAliasesByRealm: Error getting " + "hostedMetaAliases for realm: " + realm, e);
throw new WSFederationMetaException(e);
}
return metaAliases;
}
use of com.sun.identity.wsfederation.jaxb.entityconfig.FederationConfigElement in project OpenAM by OpenRock.
the class WSFedPropertiesModelImpl method setIDPExtAttributeValues.
/**
* Saves the standard attribute values for the SP.
*
* @param realm to which the entity belongs.
* @param fedId is the entity id.
* @param idpExtValues has the extended attribute value pairs of IDP.
* @param location has the information whether remote or hosted.
* @throws AMConsoleException if saving of attribute value fails.
*/
public void setIDPExtAttributeValues(String realm, String fedId, Map idpExtValues, String location) throws AMConsoleException {
try {
String role = EntityModel.IDENTITY_PROVIDER;
// fed is the extended entity configuration under the realm
WSFederationMetaManager metaManager = getWSFederationMetaManager();
FederationConfigElement fed = metaManager.getEntityConfig(realm, fedId);
if (fed == null) {
IDPEX_DATA_MAP.put(TF_DISPNAME, Collections.EMPTY_SET);
createExtendedObject(realm, fedId, location, IDENTITY_PROVIDER, IDPEX_DATA_MAP);
fed = metaManager.getEntityConfig(realm, fedId);
}
IDPSSOConfigElement idpsso = getidpsso(fed);
if (idpsso != null) {
BaseConfigType baseConfig = (BaseConfigType) idpsso;
updateBaseConfig(idpsso, idpExtValues, role);
}
//saves the new configuration by passing new fed element created
metaManager.setEntityConfig(realm, fed);
} catch (JAXBException e) {
debug.warning("WSFedPropertiesModelImpl.setIDPExtAttributeValues", e);
throw new AMConsoleException(getErrorString(e));
} catch (WSFederationMetaException e) {
debug.warning("WSFedPropertiesModelImpl.setIDPExtAttributeValues", e);
throw new AMConsoleException(getErrorString(e));
}
}
Aggregations