Skip to main content

Auto Approval for Self-Register Users- OIM 11g R2

For Auto Approving the self register user we need to do below steps:
1. Create an Event handler to Prepopulate the organisation key for the users.
2. Create an auto approval policy for Request level self register users.
3. Create an auto approval policy for Operational level self register users.


Create an Event handler to Prepopulate the organisation key for the users:

Create a class to prepopulate the Organisation value. Below is the sample code to do that.

package com.oracle.oim.utility.eventhandler;
import java.io.PrintStream;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Set;
import oracle.iam.identity.exception.OrganizationManagerException;
import oracle.iam.identity.orgmgmt.api.OrganizationManager;
import oracle.iam.identity.orgmgmt.vo.Organization;
import oracle.iam.identity.usermgmt.api.UserManagerConstants;
import oracle.iam.identity.usermgmt.api.UserManagerConstants.AttributeName;
import oracle.iam.identity.usermgmt.api.UserManagerConstants.Operations;
import oracle.iam.platform.Platform;
import oracle.iam.platform.context.ContextAware;
import oracle.iam.platform.kernel.spi.PreProcessHandler;
import oracle.iam.platform.kernel.vo.AbstractGenericOrchestration;
import oracle.iam.platform.kernel.vo.BulkEventResult;
import oracle.iam.platform.kernel.vo.BulkOrchestration;
import oracle.iam.platform.kernel.vo.EventResult;
import oracle.iam.platform.kernel.vo.Orchestration;

public class CustomPrepopulateHandler
  implements PreProcessHandler
{
  private static final String ORG_NAME = "Xellerate Users";
  private static final String ORG_KEY_ATTR = "act_key";
  
  public CustomPrepopulateHandler()
  {
    UserManagerConstants i = null;
    UserManagerConstants.Operations o = null;
  }
  

  public EventResult execute(long processId, long eventId, Orchestration orchestration)
  {
    System.out.println("CustomPrepopulateHandler: Inside execute");
    EventResult result = new EventResult();
    String operation = orchestration.getOperation();
    long org_key = 0;
    

      org_key = 1;
      
      System.out.println("CustomPrepopulateHandler: Calling orchestration.addParameter with org_key= " + org_key + " and operation= " + operation);
      orchestration.addParameter(UserManagerConstants.AttributeName.USER_ORGANIZATION.getId(), Long.valueOf(org_key));
      System.out.println("CustomPrepopulateHandler: After orchestration");
    System.out.println("CustomPrepopulateHandler: Exiting the Execute funstion");
    return result;
  }
  
  public BulkEventResult execute(long l, long l1, BulkOrchestration bulkOrchestration)
  {
    return null;
  }
  
  public void compensate(long l, long l1, AbstractGenericOrchestration abstractGenericOrchestration) {}
  
  public boolean cancel(long l, long l1, AbstractGenericOrchestration abstractGenericOrchestration)
  {
    return false;
  }
  
  public void initialize(HashMap<String, String> hashMap) {}
}

PS : Above code is hard coded for Xellarate Organization. We can fetch the Orgnaization on the run time also.


Create Event-handler.xml file and put it in the META-INF folder of the plugin. Sample is as below:


<?xml version="1.0" encoding="UTF-8"?>
<eventhandlers xmlns="http://www.oracle.com/schema/oim/platform/kernel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oracle.com/schema/oim/platform/kernel orchestration-handlers.xsd">
<action-handler class="com.oracle.oim.utility.eventhandler.CustomPrepopulateHandler" entity-type="User" operation="CREATE" name="CustomPrepopulateHandler" stage="preprocess" order="1000" sync="TRUE"/>
</eventhandlers>

Create Plugin.xml and put it in Parallel to META-INF folder. Sample is as below:


<?xml version="1.0" encoding="UTF-8"?>
<oimplugins xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
    <plugin pluginclass="com.oracle.oim.utility.eventhandler.CustomPrepopulateHandler"
        version="1.0"
        name="CustomPrepopulateHandler">
    </plugin>
   </plugins>
</oimplugins>

Create an auto approval policy for Request level self register users.

Login to Sysadmin console as administrator and create an Approval policy as below:



Create a Simple Approval Rule to trigger the Approval Policy.


Create an auto approval policy for Operation level self register users.



Login to Sysadmin console as administrator and create an Approval policy as below:



Create a Simple Approval Rule to trigger the Approval Policy.









Comments

  1. You gave me great hints for achieving organization prepopulation on self registration. Thanks :)

    ReplyDelete
  2. Really nice and definitely it will be useful for many people. Kindly keep update like this.

    Manpower Consultancy in Chennai

    Hr Consultancy in Chennai

    Recruitment Consultancy in Chennai

    ReplyDelete
  3. Would you be interested in freelancing work.

    Kindly share your contact detail

    ReplyDelete

Post a Comment

Popular posts from this blog

Developing Prepopulate Adapter with OIM 11g R2

1.      Prepopulate Adapter in OIM uses the plugin point oracle.iam.request.plugins.PrePopulationAdapte r. 2.      Write the Java code which returns the value which has to be populated on the form. 3.      This code will implement the plugin point oracle.iam.request.plugins.PrePopulationAdapte r. Code Snippet: - package com.oracle.oim.utility.eventhandler; import java.io.Serializable; import java.util.Iterator; import java.util.List; import java.util.logging.Logger; import oracle.iam.identity.exception.NoSuchUserException; import oracle.iam.identity.exception.UserLookupException; import oracle.iam.identity.usermgmt.api.UserManager; import oracle.iam.identity.usermgmt.vo.User; import oracle.iam.platform.Platform; import oracle.iam.platform.authz.exception.AccessDeniedException; import oracle.iam.request.exception.RequestServiceException; import oracle.iam.request.vo.Beneficiary; ...

Custom Login Page Protection- OAM 11g R2

Create a login page with fields having username,password and requestid. Below is the sample login page : <%@page language="java" session="true" contentType="text/html;charset=ISO-8859-1"  %> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request. getServerPort()+path+"/"; String requestID = request.getParameter("request_id"); %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <font color="blue">Login Page </font><br><br> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Implementing css and javascript</title> <meta http-equi...

Oracle Traffic Director (OTD) configuration

Download the OTD software and install it on a server by running runInstaller command from <Binaries>/Disk1. Preferred is to configure the OTD as root user because when the administration server is configured as root, then Oracle Traffic Director starts the keepalived daemon automatically when you start instances that are part of a failover group, and stops the daemon when you stop the instances. Set Oracle_Home as the new Installed OTD Home. Run below command to configure the Admin server: <OTD_HOME>/otd/bin/tadm configure-server --port=8989 --user=admin --server-user=root --instance- home= <OTD_HOME> /otd/instance_name/otd_instance1 This command will ask for admin password and will create the admin server. Run Below command to start the admin server: <OTD_HOME> /otd/instance_name/otd_instance1/admin-server/bin/startserv Login to the OTD console on http://<host>:8989 as admin user.  Click New configuration: Click Next and create ne...