Scenario 1 – We want to calculate the SHA 256 hash of a user’s LDAP attribute using a salt. Assume that salt is also an LDAP attribute of the user.
IDP : /opt/novell/nids/lib/webapp/WEB-INF/classes
Admin console : /var/opt/novell/iManager/nps/WEB-INF/classes
For our current scenario create a folder testProj under classes folder and keep this complied “Hashing” class under that.
var hashLib= Java.type('testProj.Hashing');
var vaHashLib = new hashLib();
Here we are calling testProj.Hashing class’s getHash() function and passing user attributes P1 and P2 to it . You can test the virtual attribute as below:
After testing, save Virtual attribute and update IDP.
Please find the Java class used above in the attachment section of this cool solution.
Scenario 2 :
Some function from external java library is required in virtual attributes for modifications.
Place the external library under following location and restart the IDP and Admin console service.
IDP : /opt/novell/nids/lib/webapp/WEB-INF/lib
Admin console : /var/opt/novell/iManager/nps/WEB-INF/lib
var extLib= Java.type(‘<class name with full package name’);
var vaExtLib = new extLib();
return vaExtLib.<function name in the class> (<parameters>);
(For more information on Virtual attributes please check /cyberres/accmgmt/accessmanager/w/access_manager_tips/25980/user-attribute-transformations-in-access-manager-4-2-virtual-attributes)