IDProvider call from User App (IDM 4.0.1)

1 Likes
over 10 years ago

The ID-Provider provides a quick and powerful way to generate unique ID's. Here, we will discuss how to set it up so that a User App Workflow can call the ID Provider and get a sequential unique value for object creation.

After installing IDM 4.0.1 with all the necessary components, we need to do the following:

Copy the idprovider.jar from the [path]/eDirectory/lib/dirxml/classes/ to the [jboss]/common/lib/ location.

Using Designer 4.0.1, deploy the ID Provider Package. Because we're only interested in Remote calls for the ID Provider, we make the following changes to the ID Provider Driver's Driver Parameters:

  • Clear out the default value for ID Generation Map
  • Enable the RMI Interface
  • Specify the listening IP and Port

We also need to clear out the Driver's Filter.

Create your ID Policies as required. In this example, my ID Policy is called "Employer" and prepends it with "E" and pads with 0 up to the maximum 2147483647.

For ease of migration and a central point of configuration, add the following to the Driver Set Global Configuration:

< header display-name="ID Provider Settings"/>
< group>
< definition display-name="Show ID Provider Settings" name="idv.dit.idprovider.display" type="enum">
< enum-choice display-name="show">show< /enum-choice>
< enum-choice display-name="hide">hide< /enum-choice>
< value>hide< /value>
< /definition>
< subordinates active-value="show">
< definition display-name="ID Provider RMI IP Address" name="idv.idprovider.ip" type="string">
< description>IP Address of the ID Provider RMI interface.< /description>
< value>192.168.111.10< /value>
< /definition>
< definition display-name="ID Provider RMI Port" name="idv.idprovider.port" type="string">
< description>Port of the ID Provider RMI interface.

Default Value: 1199< /description>
< value>1099< /value>
< /definition>
< /subordinates>
< /group>

Now, in the Workflow, create a Mapping Activity. In this example, the Target Expression is flowdata.map/unique_dn with a Source Expression of:

BuildDN();

function BuildDN() {
    var idpip = GCV.get('idv.idprovider.ip');    // Read the DS GCV for the IP
    trace(idpip);                                          // Trace to jboss.log
    var idpp = GCV.get('idv.idprovider.port'); // Read the DS GCV for the Port
    trace(idpp);                                          // Trace to jboss.log
    var pf = GCV.get('idv.org.ldap.ou');         // Read the DS GCV for my other param
    trace(pf);
    var ue = Packages.com.novell.idm.idprovider.IDClient.getNextID(idpip,idpp,'Employer','UserApp','3'); // (ip, port, policy, client-id, trace)
    trace(ue);                                            // Trace to jboss.log
    var udn = 'ou=';
    udn = udn   ue   ','   pf;                    //build DN
    return udn;                                        //return DN
}

function trace(msg) {
java.lang.System.out.println('flowdata\.map\/unique_dn: '   msg);
}

The Entity Activity can now reference the flowdata.map value.

The jboss.log trace should show something similar to:

15:15:58,789 INFO  [STDOUT] flowdata.map/unique_dn: 192.168.111.10
15:15:58,818 INFO  [STDOUT] flowdata.map/unique_dn: 1099
15:15:58,855 INFO  [STDOUT] flowdata.map/unique_dn: ou=ORGANISATIONS,o=COMMUNITY
15:15:59,158 INFO  [STDOUT] 15:15:59 IDClient: Getting ID from "//192.168.111.10:1099/IDProvider"...
15:15:59,558 INFO  [STDOUT] 15:15:59 IDClient: OK.
15:15:59,558 INFO  [STDOUT] 15:15:59 IDClient: ID: E0000000005
15:15:59,558 INFO  [STDOUT] flowdata.map/unique_dn: E0000000005

Labels:

Support Tip
Comment List
Anonymous
  • If you haven't restarted the web service after copying the idprovider jar across, you will need to. Being Java, the classpath and related libraries are only loaded at startup. Make sure the jar was place in a location where the IDMProv weblogic instance can see it.
  • Hi,

    I'm getting the following error when i tried to deploy the solution
    We are using Web logic to host the userapplication

    2018-05-10 23:25:27,778 ERROR [RBPM] [com.novell.soa.af.impl.activity.ActivityNode:handleException] Error Evaluating Script Error Evaluating Script com.novell.soa.script.mozilla.javascript.EcmaError: TypeError: getNextID is not a function.
    2018-05-10 23:25:27,779 ERROR [RBPM] [com.novell.soa.af.impl.LogEvent:logError] [Workflow_Error] Initiated by cn=ahu1162,ou=Employees,ou=People,o=vale, Error Message: Dataitem [MAP0] with expression [BuildDN();^M
    function BuildDN() {^M
    var idpip = "180.23.20.47"; // Read the DS GCV for the IP^M
    var idpp = 1199; // Read the DS GCV for the Port^M
    var ue = Packages.com.novell.idm.idprovider.IDClient.getNextID(idpip,idpp,'Contractor_AccessID','ID-Provider Driver','3'); // (ip, port, policy, client-id, trace)^M
    return ue; //return DN^M
    }] failed to evaluate.


    What may be the issue?
    Do we need to do a restart of the weblogic instance?

    Thank in advance,
    Agnel
  • JBoss and Tomcat are very different Web Servers, therefore behaviour is expected to be different.
  • With IDM 4.5 and up , it will not work to put idprovider,jar in the common/lib in tomcat.
    Instead , just move the file to the [tomcat]/lib directory and everything works fine again.
  • What web server is your User App running on for this?
  • Hello. I´ve tried to apply the solution in my environment but when I run my workflow I get the following error:

    Error Evaluating Script Error Evaluating Script com.novell.soa.script.mozilla.javascript.EcmaError: TypeError: getNextID is not a function.

    I´ve installed the ID-PROVider driver successfully, but the directory [jboss] does not exist in my environment.

    I´m new using IDM. We are using IDM 4.0.2.

    Any help?

    Tks

    Adriano
Related Discussions
Recommended