SailPoint: BeforeOperationRule: getNativeIdentity()

Which IIQ version are you inquiring about?

8.4p1

Hi,

I’m working on a WebServiceBeforeOperationRule to implement “Get Object” Connector Operations, I want to provide an “Aggregating a single account from an application” as explained in this topic

Aggregating a single account from an application

I need to provide an UID in a soap message to the webservice to implemenet the request.

I’ve got an exeption because “provisioningPlan is null” as shown in this snipped:

import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

String uid= provisioningPlan.getNativeIdentity();

Map bodyMap = requestEndPoint.getBody();
String body = bodyMap.get("jsonBody");
if ( null != uid) {
	body = body.replace("uid", uid);
}
bodyMap.put("jsonBody", body);
requestEndPoint.setBody(bodyMap);
return requestEndPoint;

and I don’t know where retreive the account identifier, I also tried to use $getObject.NativeIdentity$

Thanks for your help!
Gianfranco

hi @giafderosa Please check below code
if ( null != nni) {
body = body.replace(“uid”, uid);
}

ALso you can directly use in body like plan.nativeIdentity no need to use before provisioing rule.
if issue still there then send me Screenshot form ui what is there in Body

Hi @mkumariaas,

Thank for you answer!

I’ve shared part of the code because it contains client’s custom packages name.

if ( null != uid)

I’m implementing a"Connector Operation", in particular the “Before Rule” for the “Get Object” operation.

I tried to use “plan.nativeIdentity” directly in the body and it works! Great!

I’m using the before rule becase I need to retreive others parameters, (env specific), to fill out the SOAP message with the UID.

Do you have any idea how retreive “nativeIdentity” in the rule itself?

Thanks,
Gianfranco

Hi @giafderosa ,

Try with the following code:

for (AccountRequest accReq : provisioningPlan.getAccountRequests()){
     if (accReq.getOperation().equals(ProvisioningPlan.AccountRequest.Operation.Modify)) {
          Identity id=context.getObjectByName(Identity.class,accReq.getNativeIdentity());
     }
}

Hi @giafderosa

In my opinion, this situation is a bit tricky. The ‘provisioningPlan’ may or may not be present, as this operation is intended to aggregate a single object rather than provision it. Therefore, it’s valid if the provisioningPlan is null. This rule might execute immediately after provisioning or during the perform identity request maintenance task. However, this wouldn’t apply if you use it in the body or context URL. I suggest placing $plan.nativeIdentity$ directly in the body, then retrieving the body in the before rule. This way, you can access the plan’s nativeIdentity, modify it, and update the body within the rule itself.

Hi @giafderosa,

As you know, the getObject operation will not have a body. You can extract the data from the URL by splitting the full URL.

For example, if the URL is like contexturl/IdValue=$getobject.nativeIdentity$


String[] urlArr = requestEndPoint.getFullUrl().split("=");

String nativeIdentity = urlArr[urlArr.length - 1];

Based on the native identity, call other methods to obtain the desired attributes before constructing the request endpoint.


requestEndPoint.setFullUrl(requestEndPoint.getFullUrl().concat(**required perms)*));

Thanks,
@SivaLankapalli

Hi @angelborrego,

unfortunately “provisioningPlan” is null in this operation.

Gianfranco

Hello,

Thanks everyone for your suggestion! Here how I solved this problem:

Application Type: WebService
Operation: Get Object

BODY

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:gar="http://__SOME__SCHEMA__">
<soapenv:Header/>
<soapenv:Body>
<gar:AggregUserRequest vtaRequester="VTAREQUESTER" requester="VTAREQUESTER" uid="$plan.nativeIdentity$" />
</soapenv:Body>
</soapenv:Envelope>

RULE

Rule Type: WebServiceBeforeOperationRule

import java.util.Map;
import custom.package.IDMService;

IDMService service = new IDMService(context, log);
String vtaRequester=  service.getRequester();
   
Map bodyMap = requestEndPoint.getBody();
String body = bodyMap.get("jsonBody");
if ( null != vtaRequester) {
	body = body.replace("VTAREQUESTER", vtaRequester);
}
bodyMap.put("jsonBody", body);
requestEndPoint.setBody(bodyMap);
return requestEndPoint;

Finally I used the $plan.nativeIdentity$ in the body, as @Arpitha1 and @mkumariaas suggested.

Another solution is to use $getobject.nativeIdentity$ in the requestEndPoint, as SivaLankapalli suggested

Cheers,
Gianfranco

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.