use of com.sun.identity.wsfederation.jaxb.entityconfig.IDPSSOConfigElement 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.IDPSSOConfigElement in project OpenAM by OpenRock.
the class WSFederationSingleLogoutHandler method findIDPMetaAlias.
/**
* Returns the WSFed IDP metaAlis which is in the same COT as the initiation
* IDP and SP. Return null if such WSFed IDP does not exist or exception
* occurs.
*/
private String findIDPMetaAlias(String idpEntityID, String spEntityID, String realm, String protocol) {
try {
WSFederationMetaManager metaManager = WSFederationUtils.getMetaManager();
List hostedIdps = metaManager.getAllHostedIdentityProviderEntities(realm);
if (debug.messageEnabled()) {
debug.message("WSFedSingleLogoutHandler.findIDPMetaAlias: " + " all hosted WS-Fed IDPs = " + hostedIdps);
}
if ((hostedIdps == null) || hostedIdps.isEmpty()) {
return null;
}
CircleOfTrustManager cotManager = new CircleOfTrustManager();
Set cots = cotManager.getAllActiveCirclesOfTrust(realm);
int num = hostedIdps.size();
for (int i = 0; i < num; i++) {
String idpId = (String) hostedIdps.get(i);
Iterator it = cots.iterator();
while (it.hasNext()) {
String cotName = (String) it.next();
if (debug.messageEnabled()) {
debug.message("WSFedSLOHandler.findIDPMetaAlias: " + " check COT = " + cotName);
}
// check if this cot contains the wsfed IDP to be checked
Set providers = cotManager.listCircleOfTrustMember(realm, cotName, SingleLogoutManager.WS_FED);
if ((providers == null) || !providers.contains(idpId)) {
continue;
}
providers = cotManager.listCircleOfTrustMember(realm, cotName, protocol);
if ((providers == null) || !providers.contains(idpEntityID)) {
continue;
}
if ((spEntityID != null) && (spEntityID.length() != 0) && !providers.contains(spEntityID)) {
continue;
}
// but just stop here right now.
if (SingleLogoutManager.debug.messageEnabled()) {
SingleLogoutManager.debug.message("WSFedSingleLogoutHandler.findIDPMetaAlias : " + "found IDP " + idpId + " in COT " + cotName);
}
IDPSSOConfigElement config = metaManager.getIDPSSOConfig(realm, idpId);
return config.getMetaAlias();
}
}
} catch (Exception e) {
SingleLogoutManager.debug.error("WSFederationSingleLogoutHandler." + "findIDPMetaAlias", e);
}
return null;
}
Aggregations