Thursday, February 21, 2013

OIM : User Management

User Management

The OIM 11gR1 Java APIs support searching, creating, reading, updating and deleting of Users. This thread demonstrates cover how to use the OIM 11gR1 Java APIs to perform these operations.

Required server files

You will need to obtain the following files from the OIM 11gR1 server:
  • The OIM 11gR1 Java API classes are packaged as a jar file called oimclient.jar. This jar file is packaged within the file. The file is located in the OIM_ORACLE_HOME/server/client folder, on the OIM 11gR1 server.
  • Copy from the OIM 11gR1 server:
    scp user@oimserver:/OIM_ORACLE_HOME/server/client/ .
  • Expand the file:
  • Access the Weblogic Server system
    ssh user@wlserver
  • Change directories to the server/lib directory.
    cd WL_HOME/server/lib
  • Use the following command to create the wlfullclient.jar file in the server/libdirectory:
    java -jar wljarbuilder.jar
  • Copy the wlfullclient.jar file.

Create A User In OIM using OIM API.

package com.mindtelligent.oim.user.client;

import java.util.HashMap;

import oracle.iam.identity.usermgmt.api.UserManager;
import oracle.iam.identity.usermgmt.vo.User;
import oracle.iam.identity.usermgmt.vo.UserManagerResult;

public class UserCreate extends ClientUser
   public UserCreate() throws Exception
   public static void main(String[] args) throws Exception

      UserCreate test = new UserCreate();

      catch (Exception ex)
         test.log("EXCEPTION: " + ex.getMessage());

   protected void execute() throws Exception
      long i = 1;
      String accountId = "hsaluja";
      String first = "Harvinder";
      String last = "Saluja";
      HashMap<String, Object> mapAttrs = null;
      UserManager umgr = null;         // OIMClient API
      UserManagerResult result = null; // OIMClient API
      User user = null;                // OIMClient API


      umgr = this.getUserManager();

      mapAttrs = new HashMap<String, Object>();
      mapAttrs.put("User Login", accountId);
      mapAttrs.put("First Name", first);
      mapAttrs.put("Last Name", last);
      mapAttrs.put("usr_password", "Passw0rd");
      mapAttrs.put("Email", first + "." + last + "");
      mapAttrs.put("act_key", new Long(i));
      mapAttrs.put("Xellerate Type", "End-User");
      mapAttrs.put("Role", "Full-Time");  // User Type

      user = new User(accountId, mapAttrs);

      this.log("User object created: '" + accountId + "'");

       * Create the user

      result = umgr.create(user);

      this.log("Creation status: '" + result.getStatus() + "'");



Share your code in Git using Eclipse

Share your code in Git using Eclipse Share your Eclipse project with your team in an Azure DevOps Services/TFS Git repo. Prerequisites ...