use of com.sun.identity.federation.jaxb.entityconfig.IDPDescriptorConfigElement in project OpenAM by OpenRock.
the class IDFFSingleLogoutHandler method findIDPMetaAlias.
/**
* Returns the IDFF IDP metaAlis which is in the same COT as the initiation
* IDP and SP. Return null if such IDFF IDP does not exist or exception
* occurs.
*/
private String findIDPMetaAlias(String idpEntityID, String spEntityID, String realm, String protocol) {
try {
IDFFMetaManager idffManager = new IDFFMetaManager(null);
List hostedIdps = idffManager.getAllHostedIdentityProviderIDs(realm);
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();
// check if this cot contains all entities
Set providers = cotManager.listCircleOfTrustMember(realm, cotName, SingleLogoutManager.IDFF);
if ((providers == null) || !providers.contains(idpId)) {
continue;
}
providers = cotManager.listCircleOfTrustMember(realm, cotName, protocol);
if ((providers == null) || !providers.contains(idpEntityID)) {
continue;
}
if ((spEntityID != null) && !providers.contains(spEntityID)) {
continue;
}
// but just stop here right now.
if (SingleLogoutManager.debug.messageEnabled()) {
SingleLogoutManager.debug.message("IDFFSingleLogoutHandler.findIDPMetaAlias : " + "found IDP " + idpId + " in COT " + cotName);
}
IDPDescriptorConfigElement config = idffManager.getIDPDescriptorConfig(realm, idpId);
return config.getMetaAlias();
}
}
} catch (Exception e) {
SingleLogoutManager.debug.error("IDFFSingleLogoutHandler." + "findIDPMetaAlias", e);
}
return null;
}
Aggregations