This example can be used in the following scenario:
- User-Id is unique across all Services
- For a particular person, same user-id needs to be used for all resources.

In order to deploy this example on itim 4.5.1, Please follow configuration steps given below:  
Steps to configure and use the JS Extension :-
----------------------------------------------------
1. Build the source file UniqueUserID.java 
    Include itim_server.jar,itim_api.jar and fesi.jar for WebSphere /
    	enroleall.jar and fesi.jar for WebLogic, in the Classpath 
2. The Build will produce following three class files -
    UniqueUserID$1.class
    UniqueUserID$GetUniqueUserID.class
    UniqueUserID.class
    Add these files to a jar and add this jar to Classpath 
    (For details please refer: %ITIM_HOME%/extensions/examples/Classpath.html).    
    
3. Add the following line in %ITIM_HOME%\data\fesiextensions.properties:
    fesi.extension.IdentityPolicy.second=UniqueUserID
4. Restart enRole application.
5. Define/Modify Identity Policy by creating the following java script:
    //<--------- START ------------>
    function createIdentity()
    {
      var erglobalid = subject.getProperty("erglobalid")[0];
      var serviceId = service.getProperty("erglobalid")[0];
      
      // It returns empty if no account is created for person.
      var baseidentity = getUniqueUserID(erglobalid, serviceId);
      
       if(baseidentity != "") {
            return baseidentity;
       }
       else
       {
           //Logic for creating base Identity
            var sn = subject.getProperty("sn")[0];
            var cn = subject.getProperty("cn")[0];
            baseIdentity = cn.substring(0,1) + sn;
            var identity = baseIdentity;
            var counter = 0;
            var exists = IdentityPolicy.userIDExists(identity, true, false);
            
            while(exists)
            {
                counter = counter +1;
                identity = baseIdentity + counter;
                exists = IdentityPolicy.userIDExists(identity, true, false);
            }
    
            return identity;
       }
    } // end function
    return createIdentity();
    
    //<--------- END ------------>