Hashing with SHA-256 in Javascript

importPackage(java.io); importPackage(Packages.java.lang); importClass(java.security.MessageDigest); importClass(java.nio.charset.StandardCharsets); importClass(java.lang.StringBuffer); var varMyString = “JIMBO”; var varDigest = MessageDigest.getInstance(“SHA-256”); var varOriginalString = new java.lang.String(varMyString); var varHashedString = varDigest.digest(varOriginalString.getBytes(StandardCharsets.UTF_8)); var varFinalString = new StringBuffer(); for (i = 0; i < varHashedString.length; i++) { varFinalString.append(Integer.toString((varHashedString[i] & 0xff) + 0x100, 16).substring(1)); } print (“hash: ” + varFinalString);

Encrypt data using Public Key

Often times you will want to scramble data before you store it in an LDAP directory or a database. The quickest method is to simply obfuscate the data by replacing each character in the original data with different ones, of course by using a known algorithm. For example, shifting the characters over two places on the ASCII scale before replacement. … Read More

JDE Julian Date conversion

Below you will find a JavaScript program which will convert JD Edwards Julian Dates to Java dates. The output format can be tweaked to your liking.

The code handles LEAP year conversion, as the following examples show. 2004 is a LEAP year, 1971 is not. Kekes-MacBook-Pro:Downloads karmst$ rhino -f jimbo.js JDE Date: 104138 Out Date: 20040517 Kekes-MacBook-Pro:Downloads karmst$ rhino … Read More

Call PowerShell from IDM engine (Windows only)

If you have your NetIQ IDM Engine on eDirectory which is running on a Windows Server, then you might just want to call PowerShell directly from the Engine; at least you have the capability of doing so. The following code snippets (both DirXML Script and ECMAScript) will allow you to do just that. Of course, this only works on Windows, … Read More

Communicate between NetIQ IDM Connectors

It is possible to get one Connector to ‘talk to‘ another Connector, thereby transferring data from one Connector to another. An example use case might be that you want to query if a User already exists in an Active Directory Domain before assigning a unique User ID in the Identity Vault. Or you might want to check one Active Directory Domain … Read More

Test XSLT using Java and a bash script

I was recently asked to implement an XSLT Stylesheet to be used within a NetIQ IDM Connector. Rather than start up my CentOS Virtual Machine (VM), I decided to take a different approach: test the XSLT from the command line. Fortunately, it’s not very difficult to do this by using the built in XSLT processor in Java. Using java com.sun.org.apache.xalan.internal.xsltc.cmdline … Read More

Secondary Account Management with NetIQ IDM

One of our new offerings is the Secondary Account Management (SAM) Solution. The SAM Solution implements a 1..n relationship (or parent -> child) solution for linking Primary and Secondary accounts in your NetIQ eDirectory Tree. With the Belkast solution: Secondary accounts are identified and linked to their owner’s Primary account. Secondary accounts are governed by an identity lifecycle – with options to remove, reassign, … Read More

ECMAScript to compare two arrays

It is sometimes useful to be able to compare two arrays before loading the result into an MVEditor or a list. A few scenarios of when you might want to use this code are: When you want to determine which Groups to display to a User on a Workflow form, knowing that some Groups are restricted and should not be … Read More

Password reset from a Workflow

We have developed a custom method by which a User, with the correct rights, can change the password on a User from within a Workflow. What makes this important is that the password change is integrated with a custom Java class which calls NMAS methods to do the password change. The password change is thus verified and, on an error, … Read More

Manipulate a string as XML

I was recently asked to provide code which satisfied the following specification: In flowdata for a PRD I am trying to do the following in a mapping activity. I have a string, which looks like this (example): “<data><startdate>2012-06-20T12:26:32.000+02:00</startdate><enddate>2012-07-17T12:26:32.000+02:00</enddate><udlaaner>24222</udlaaner><modtager>24300</modtager><initiator>cn=ADMKEVRAS,ou=sa,o=data</initiator><desc><value>Test 11</value></desc><A1>[DN on a group]</A1></data>” This string is just a stringified XML stored on a String attribute in edirectory. In clean XML it … Read More