use of com.sun.identity.plugin.configuration.ConfigurationException in project OpenAM by OpenRock.
the class WSFederationMetaManager method setEntityConfig.
/**
* Sets the extended entity configuration under the realm.
*
* @param realm The realm under which the entity resides.
* @param config The extended entity configuration object to be set.
* @throws WSFederationMetaException if unable to set the entity
* configuration.
*/
public void setEntityConfig(String realm, FederationConfigElement config) throws WSFederationMetaException {
String federationId = config.getFederationID();
if (federationId == null) {
debug.error("WSFederationMetaManager.setEntityConfig: " + "entity ID is null");
String[] data = { realm };
LogUtil.error(Level.INFO, LogUtil.NO_ENTITY_ID_SET_ENTITY_CONFIG, data, null);
throw new WSFederationMetaException("empty_entityid", null);
}
if (realm == null) {
realm = "/";
}
String[] objs = { federationId, realm };
try {
Map attrs = WSFederationMetaUtils.convertJAXBToAttrMap(ATTR_ENTITY_CONFIG, config);
Map oldAttrs = configInst.getConfiguration(realm, federationId);
oldAttrs.put(ATTR_ENTITY_CONFIG, attrs.get(ATTR_ENTITY_CONFIG));
configInst.setConfiguration(realm, federationId, oldAttrs);
LogUtil.access(Level.INFO, LogUtil.SET_ENTITY_CONFIG, objs, null);
} catch (ConfigurationException e) {
debug.error("WSFederationMetaManager.setEntityConfig:", e);
String[] data = { e.getMessage(), federationId, realm };
LogUtil.error(Level.INFO, LogUtil.CONFIG_ERROR_SET_ENTITY_CONFIG, data, null);
throw new WSFederationMetaException(e);
} catch (JAXBException jaxbe) {
debug.error("WSFederationMetaManager.setEntityConfig:", jaxbe);
LogUtil.error(Level.INFO, LogUtil.SET_INVALID_ENTITY_CONFIG, objs, null);
throw new WSFederationMetaException("invalid_config", objs);
}
}
use of com.sun.identity.plugin.configuration.ConfigurationException in project OpenAM by OpenRock.
the class WSFederationMetaManager method getEntityByTokenIssuerName.
/**
* Returns entity ID associated with the token issuer name.
*
* @param issuer Token issuer name.
* @return entity ID associated with the metaAlias or null if not found.
* @throws WSFederationMetaException if unable to retrieve the entity ids.
*/
public String getEntityByTokenIssuerName(String realm, String issuer) throws WSFederationMetaException {
try {
Set entityIds = configInst.getAllConfigurationNames(realm);
if (entityIds == null || entityIds.isEmpty()) {
return null;
}
for (Iterator iter = entityIds.iterator(); iter.hasNext(); ) {
String federationId = (String) iter.next();
FederationElement fed = getEntityDescriptor(realm, federationId);
if (issuer.equals(getTokenIssuerName(fed))) {
return federationId;
}
}
} catch (ConfigurationException e) {
debug.error("WSFederationMetaManager.getEntityByMetaAlias:", e);
throw new WSFederationMetaException(e);
}
return null;
}
use of com.sun.identity.plugin.configuration.ConfigurationException in project OpenAM by OpenRock.
the class WSFederationMetaManager method deleteFederation.
/**
* Deletes the standard metadata entity descriptor under the realm.
*
* @param realm The realm under which the entity resides.
* @param federationId The ID of the entity for whom the standard entity
* descriptor will be deleted.
* @throws WSFederationMetaException if unable to delete the entity
* descriptor.
*/
public void deleteFederation(String realm, String federationId) throws WSFederationMetaException {
if (federationId == null) {
return;
}
if (realm == null) {
realm = "/";
}
String[] objs = { federationId, realm };
try {
// Remove the entity from cot
IDPSSOConfigElement idpconfig = getIDPSSOConfig(realm, federationId);
if (idpconfig != null) {
removeFromCircleOfTrust(idpconfig, realm, federationId);
}
SPSSOConfigElement spconfig = getSPSSOConfig(realm, federationId);
if (spconfig != null) {
removeFromCircleOfTrust(spconfig, realm, federationId);
}
// end of remove entity from cot
configInst.deleteConfiguration(realm, federationId, null);
LogUtil.access(Level.INFO, LogUtil.ENTITY_DESCRIPTOR_DELETED, objs, null);
WSFederationMetaCache.putFederation(realm, federationId, null);
} catch (ConfigurationException e) {
debug.error("WSFederationMetaManager.deleteFederation:", e);
String[] data = { e.getMessage(), federationId, realm };
LogUtil.error(Level.INFO, LogUtil.CONFIG_ERROR_DELETE_ENTITY_DESCRIPTOR, data, null);
throw new WSFederationMetaException(e);
}
}
use of com.sun.identity.plugin.configuration.ConfigurationException in project OpenAM by OpenRock.
the class WSFederationMetaManager method setFederation.
/**
* Sets the standard metadata entity descriptor under the realm.
*
* @param realm The realm under which the entity resides.
* @param federation Federation object.
* @throws WSFederationMetaException if unable to set the entity descriptor.
*/
public void setFederation(String realm, FederationElement federation) throws WSFederationMetaException {
String federationId = federation.getFederationID();
if (federationId == null) {
federationId = WSFederationConstants.DEFAULT_FEDERATION_ID;
}
if (realm == null) {
realm = "/";
}
String[] objs = { federationId, realm };
try {
Map attrs = WSFederationMetaUtils.convertJAXBToAttrMap(ATTR_METADATA, federation);
Map oldAttrs = configInst.getConfiguration(realm, federationId);
oldAttrs.put(ATTR_METADATA, attrs.get(ATTR_METADATA));
configInst.setConfiguration(realm, federationId, oldAttrs);
LogUtil.access(Level.INFO, LogUtil.SET_ENTITY_DESCRIPTOR, objs, null);
} catch (ConfigurationException e) {
debug.error("WSFederationMetaManager.setFederation:", e);
String[] data = { e.getMessage(), federationId, realm };
LogUtil.error(Level.INFO, LogUtil.CONFIG_ERROR_SET_ENTITY_DESCRIPTOR, data, null);
throw new WSFederationMetaException(e);
} catch (JAXBException jaxbe) {
debug.error("WSFederationMetaManager.setFederation:", jaxbe);
LogUtil.error(Level.INFO, LogUtil.SET_INVALID_ENTITY_DESCRIPTOR, objs, null);
throw new WSFederationMetaException("invalid_descriptor", objs);
}
}
Aggregations