use of com.sun.identity.wsfederation.jaxb.entityconfig.BaseConfigType 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.BaseConfigType 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));
}
}
use of com.sun.identity.wsfederation.jaxb.entityconfig.BaseConfigType in project OpenAM by OpenRock.
the class WSFedPropertiesModelImpl method createExtendedObject.
/**
* Creates the extended config object when it does not exist.
* @param realm to which the entity belongs.
* @param fedId is the entity id.
* @param location is either hosted or remote
* @param role is SP, IDP or SP/IDP.
* @param keys which contain all extended attribute keys.
* @throws WSFederationMetaException, JAXBException,
* AMConsoleException if saving of attribute value fails.
*/
private void createExtendedObject(String realm, String fedId, String location, String role, Map keys) throws WSFederationMetaException, JAXBException, AMConsoleException {
try {
ObjectFactory objFactory = new ObjectFactory();
WSFederationMetaManager metaManager = getWSFederationMetaManager();
FederationElement edes = metaManager.getEntityDescriptor(realm, fedId);
if (edes == null) {
if (debug.warningEnabled()) {
debug.warning("WSFedPropertiesModelImpl.createExtendedObject: " + "No such entity: " + fedId);
}
String[] data = { realm, fedId };
throw new WSFederationMetaException("fedId_invalid", data);
}
FederationConfigElement eConfig = metaManager.getEntityConfig(realm, fedId);
if (eConfig == null) {
BaseConfigType bctype = null;
FederationConfigElement ele = objFactory.createFederationConfigElement();
ele.setFederationID(fedId);
if (location.equals("remote")) {
ele.setHosted(false);
}
List ll = ele.getIDPSSOConfigOrSPSSOConfig();
// Right now, it is either an SP or an IdP or dual role
if (isDualRole(edes)) {
//for dual role create both idp and sp config objects
BaseConfigType bctype_idp = null;
BaseConfigType bctype_sp = null;
bctype_idp = objFactory.createIDPSSOConfigElement();
bctype_idp = createAttributeElement(keys, bctype_idp);
bctype_sp = objFactory.createSPSSOConfigElement();
bctype_sp = createAttributeElement(keys, bctype_sp);
ll.add(bctype_idp);
ll.add(bctype_sp);
} else if (role.equals(IDENTITY_PROVIDER)) {
bctype = objFactory.createIDPSSOConfigElement();
//bctype.getAttribute().add(atype);
bctype = createAttributeElement(keys, bctype);
ll.add(bctype);
} else if (role.equals(SERVICE_PROVIDER)) {
bctype = objFactory.createSPSSOConfigElement();
bctype = createAttributeElement(keys, bctype);
ll.add(bctype);
}
metaManager.setEntityConfig(realm, ele);
}
} catch (JAXBException e) {
debug.warning("WSFedPropertiesModelImpl.createExtendedObject", e);
throw new AMConsoleException(getErrorString(e));
} catch (WSFederationMetaException e) {
debug.warning("WSFedPropertiesModelImpl.createExtendedObject", e);
throw new AMConsoleException(getErrorString(e));
}
}
Aggregations