Hello,
I am working with a ManagerCorrelation Rule in SailPoint Identity Security Cloud and I have some questions regarding its execution.
The rule was developed and tested locally using the Rule Development Kit. It also passed the unit tests we created for the different manager-correlation scenarios. I then deployed the rule to the tenant, but after running aggregations and performing tests, I do not see any change in the identity manager.
The rule logic is as follows:
- I have two authoritative sources associated with the same identity: a CSV source and a NERM source.
- If the CSV account is active, the manager should be obtained from the
Managerattribute. - If the NERM account is active, the manager should be obtained from
erc_ne_attribute. - If both accounts are inactive, their end dates are compared and the manager from the source with the most recent end date is used.
- The resulting value contains the manager’s username and should be correlated against the identity attribute
uid.
The rule is already deployed, but I cannot determine whether:
- the rule is failing during execution,
- the rule is never being invoked,
- or some additional configuration is required to associate it correctly with the authoritative sources/profiles.
Could you please clarify what configuration is required for a ManagerCorrelation Rule to be executed during aggregation?
I would also like to know whether there is any way to confirm through logs or an API that the rule is being invoked and what result it is returning.
My current intention is to use the same rule for both authoritative sources involved.
Any guidance or configuration example would be greatly appreciated.
"<?xml version='1.0' encoding='UTF-8'?>
Si solo existe una cuenta, utiliza el manager de esa fuente.
Si existen ambas, utiliza CSV cuando esta activa y NERM cuando CSV esta inactiva y NERM activa.
Si ambas cuentas estan inactivas, compara la fecha “Account Expiry Time” de CSV con
“fecha_fin_asignacion_ne_attribute” de la asignacion NERM creada mas recientemente y utiliza
el manager de la fuente cuya fecha de finalizacion sea posterior.
CSV utiliza “Manager”, NERM utiliza “erc_ne_attribute” y el valor obtenido se correlaciona
contra el atributo de identidad “uid”.
<![CDATA[
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.text.SimpleDateFormat;
import sailpoint.object.Identity;
import sailpoint.object.Link;
/*
* ==========================================================
* SOURCES
* ==========================================================
*/
// Fuente autoritativa CSV
String CSV_SOURCE_ID =
"b";
// NERM - perfil Persona
String NERM_PERSONA_SOURCE_ID =
"c";
// NERM - perfil Asignacion
String NERM_ASIGNACION_SOURCE_ID =
"8";
/*
* ==========================================================
* ATRIBUTOS
* ==========================================================
*/
String CSV_MANAGER_ATTR =
"Manager";
String CSV_END_DATE_ATTR =
"Account Expiry Time";
String NERM_MANAGER_ATTR =
"erc_ne_attribute";
String NERM_END_DATE_ATTR =
"fecha_fin_asignacion_ne_attribute";
String MANAGER_IDENTITY_ATTRIBUTE =
"uid";
/*
* ==========================================================
* FUNCIONES AUXILIARES
* ==========================================================
*/
/*
* Obtiene la primera cuenta asociada a una fuente.
*
* Para CSV y NERM Persona se espera una unica
* cuenta relevante por identidad.
*/
Link getFirstLinkBySourceId(
Identity identity,
String sourceId
) {
if (identity == null || sourceId == null) {
return null;
}
List links =
identity.getLinksByAppIdOrName(
sourceId,
null
);
if (links != null && !links.isEmpty()) {
return (Link) links.get(0);
}
return null;
}
/*
* Obtiene la cuenta de NERM Asignacion
* creada mas recientemente.
*
* Replica el criterio utilizado en la transform:
*
* accountSortAttribute = "created"
* accountSortDescending = true
*/
Link getNewestLinkBySourceId(
Identity identity,
String sourceId
) {
if (identity == null || sourceId == null) {
return null;
}
List links =
identity.getLinksByAppIdOrName(
sourceId,
null
);
if (links == null || links.isEmpty()) {
return null;
}
Link newestLink = null;
Date newestCreated = null;
for (Object linkObject : links) {
Link currentLink =
(Link) linkObject;
if (currentLink == null) {
continue;
}
Date currentCreated =
currentLink.getCreated();
if (newestLink == null) {
newestLink =
currentLink;
newestCreated =
currentCreated;
continue;
}
if (
currentCreated != null &&
(
newestCreated == null ||
currentCreated.after(newestCreated)
)
) {
newestLink =
currentLink;
newestCreated =
currentCreated;
}
}
return newestLink;
}
/*
* Valida que el valor del manager
* no sea nulo ni vacio.
*/
boolean hasManagerValue(
Object value
) {
if (value == null) {
return false;
}
String text =
String.valueOf(value).trim();
return !text.isEmpty();
}
/*
* Construye el resultado esperado por
* la Manager Correlation Rule.
*/
Map buildCorrelationResult(
Object managerValue
) {
Map result =
new HashMap();
if (!hasManagerValue(managerValue)) {
log.warn(
"ManagerCorrelation-CAF - "
+ "El valor del manager es nulo o vacio."
);
return result;
}
String managerUsername =
String.valueOf(managerValue).trim();
result.put(
"identityAttributeName",
MANAGER_IDENTITY_ATTRIBUTE
);
result.put(
"identityAttributeValue",
managerUsername
);
log.warn(
"ManagerCorrelation-CAF - "
+ "Correlacionando manager contra "
+ MANAGER_IDENTITY_ATTRIBUTE
+ " = "
+ managerUsername
);
return result;
}
/*
* ==========================================================
* INICIO DE LA REGLA
* ==========================================================
*/
Map returnMap =
new HashMap();
/*
* La misma regla se utilizara tanto en CSV
* como en NERM.
*
* Por lo tanto, link puede pertenecer
* a cualquiera de las dos fuentes.
*/
if (link == null) {
log.warn(
"ManagerCorrelation-CAF - "
+ "El link recibido es nulo."
);
return returnMap;
}
Identity identity =
link.getIdentity();
if (identity == null) {
log.warn(
"ManagerCorrelation-CAF - "
+ "No se pudo obtener la Identity "
+ "asociada al link."
);
return returnMap;
}
log.warn(
"ManagerCorrelation-CAF - "
+ "Procesando Identity: "
+ identity.getName()
);
/*
* Buscamos las cuentas de ambas
* fuentes autoritativas.
*/
Link csvLink =
getFirstLinkBySourceId(
identity,
CSV_SOURCE_ID
);
Link nermPersonaLink =
getFirstLinkBySourceId(
identity,
NERM_PERSONA_SOURCE_ID
);
/*
* ==========================================================
* CASO 1
*
* Existe CSV y no existe NERM Persona.
*
* Se utiliza CSV independientemente
* de su estado.
* ==========================================================
*/
if (
csvLink != null &&
nermPersonaLink == null
) {
log.warn(
"ManagerCorrelation-CAF - "
+ "Existe cuenta CSV y no existe "
+ "cuenta NERM Persona. "
+ "Se utilizara Manager de CSV."
);
Object csvManager =
csvLink.getAttribute(
CSV_MANAGER_ATTR
);
return buildCorrelationResult(
csvManager
);
}
/*
* ==========================================================
* CASO 2
*
* No existe CSV y existe NERM Persona.
*
* Se utiliza NERM independientemente
* de su estado.
* ==========================================================
*/
if (
csvLink == null &&
nermPersonaLink != null
) {
log.warn(
"ManagerCorrelation-CAF - "
+ "No existe cuenta CSV y existe "
+ "cuenta NERM Persona. "
+ "Se utilizara erc_ne_attribute de NERM."
);
Object nermManager =
nermPersonaLink.getAttribute(
NERM_MANAGER_ATTR
);
return buildCorrelationResult(
nermManager
);
}
/*
* ==========================================================
* CASO 3
*
* No existe ninguna de las dos cuentas.
* ==========================================================
*/
if (
csvLink == null &&
nermPersonaLink == null
) {
log.warn(
"ManagerCorrelation-CAF - "
+ "No se encontro cuenta CSV ni "
+ "cuenta NERM Persona."
);
return returnMap;
}
/*
* A partir de este punto existen ambas cuentas.
*/
/*
* ==========================================================
* CASO 4
*
* CSV activa + NERM inactiva.
*
* Se utiliza CSV.
* ==========================================================
*/
if (
!csvLink.isDisabled() &&
nermPersonaLink.isDisabled()
) {
log.warn(
"ManagerCorrelation-CAF - "
+ "CSV activa y NERM inactiva. "
+ "Se utilizara Manager de CSV."
);
Object csvManager =
csvLink.getAttribute(
CSV_MANAGER_ATTR
);
return buildCorrelationResult(
csvManager
);
}
/*
* ==========================================================
* CASO 5
*
* CSV inactiva + NERM activa.
*
* Se utiliza NERM.
* ==========================================================
*/
if (
csvLink.isDisabled() &&
!nermPersonaLink.isDisabled()
) {
log.warn(
"ManagerCorrelation-CAF - "
+ "CSV inactiva y NERM activa. "
+ "Se utilizara erc_ne_attribute de NERM."
);
Object nermManager =
nermPersonaLink.getAttribute(
NERM_MANAGER_ATTR
);
return buildCorrelationResult(
nermManager
);
}
/*
* ==========================================================
* CASO 6
*
* CSV inactiva + NERM inactiva.
*
* Se comparan las fechas de finalizacion.
* ==========================================================
*/
if (
csvLink.isDisabled() &&
nermPersonaLink.isDisabled()
) {
log.warn(
"ManagerCorrelation-CAF - "
+ "CSV y NERM se encuentran inactivas. "
+ "Se compararan las fechas de finalizacion."
);
/*
* Fecha fin CSV.
*
* Ejemplo:
* 15/11/2027 23:59
*/
Object csvEndDateValue =
csvLink.getAttribute(
CSV_END_DATE_ATTR
);
/*
* Buscamos la asignacion NERM
* creada mas recientemente.
*/
Link newestNermAssignment =
getNewestLinkBySourceId(
identity,
NERM_ASIGNACION_SOURCE_ID
);
if (newestNermAssignment == null) {
log.warn(
"ManagerCorrelation-CAF - "
+ "No se encontro una cuenta de "
+ "NERM Asignacion."
);
return returnMap;
}
log.warn(
"ManagerCorrelation-CAF - "
+ "Asignacion NERM mas reciente encontrada. "
+ "Created: "
+ newestNermAssignment.getCreated()
);
/*
* Fecha fin NERM.
*
* Ejemplo:
* 11/09/2026
*/
Object nermEndDateValue =
newestNermAssignment.getAttribute(
NERM_END_DATE_ATTR
);
if (
csvEndDateValue == null ||
nermEndDateValue == null
) {
log.warn(
"ManagerCorrelation-CAF - "
+ "No se pudo obtener alguna de las "
+ "fechas de finalizacion requeridas."
);
return returnMap;
}
try {
/*
* Formato CSV:
* 15/11/2027 23:59
*/
SimpleDateFormat csvDateFormat =
new SimpleDateFormat(
"dd/MM/yyyy HH:mm"
);
/*
* Formato NERM:
* 11/09/2026
*/
SimpleDateFormat nermDateFormat =
new SimpleDateFormat(
"dd/MM/yyyy"
);
csvDateFormat.setLenient(false);
nermDateFormat.setLenient(false);
Date csvEndDate =
csvDateFormat.parse(
String.valueOf(
csvEndDateValue
).trim()
);
Date nermEndDate =
nermDateFormat.parse(
String.valueOf(
nermEndDateValue
).trim()
);
log.warn(
"ManagerCorrelation-CAF - "
+ "Fecha fin CSV: "
+ csvEndDate
+ " | Fecha fin NERM: "
+ nermEndDate
);
/*
* Si CSV tiene la fecha de finalizacion
* mas reciente, utilizamos su manager.
*/
if (
csvEndDate.after(
nermEndDate
)
) {
log.warn(
"ManagerCorrelation-CAF - "
+ "La fecha de finalizacion CSV "
+ "es mas reciente. "
+ "Se utilizara Manager de CSV."
);
Object csvManager =
csvLink.getAttribute(
CSV_MANAGER_ATTR
);
return buildCorrelationResult(
csvManager
);
}
/*
* Si NERM tiene la fecha mas reciente
* o ambas fechas coinciden, utilizamos NERM.
*
* NERM queda como criterio de desempate.
*/
log.warn(
"ManagerCorrelation-CAF - "
+ "La fecha de finalizacion NERM "
+ "es mas reciente o coincide con CSV. "
+ "Se utilizara erc_ne_attribute de NERM."
);
Object nermManager =
nermPersonaLink.getAttribute(
NERM_MANAGER_ATTR
);
return buildCorrelationResult(
nermManager
);
} catch (Exception e) {
log.warn(
"ManagerCorrelation-CAF - "
+ "Error comparando fechas de finalizacion: "
+ e.getMessage()
);
return returnMap;
}
}
/*
* ==========================================================
* CASO DEFENSIVO
*
* CSV activa + NERM activa.
*
* Este escenario no deberia ocurrir.
* ==========================================================
*/
if (
!csvLink.isDisabled() &&
!nermPersonaLink.isDisabled()
) {
log.warn(
"ManagerCorrelation-CAF - "
+ "ADVERTENCIA: CSV y NERM se encuentran "
+ "activas simultaneamente. "
+ "Este escenario no deberia ocurrir "
+ "segun la regla de negocio."
);
return returnMap;
}
return returnMap;
]]>
"




