Thursday, February 21, 2013

OIM 11.1.1.5 : 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 oimclient.zip file. The oimclient.zip file is located in the OIM_ORACLE_HOME/server/client folder, on the OIM 11gR1 server.
  • Copy oimclient.zip from the OIM 11gR1 server:
    scp user@oimserver:/OIM_ORACLE_HOME/server/client/oimclient.zip .
  • Expand the oimclient.zip file:
    unzip oimclient.zip
  • 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
   {
      super();
      return;
   }
   public static void main(String[] args) throws Exception
   {

      UserCreate test = new UserCreate();

      try
      {
         test.execute();
      }
      catch (Exception ex)
      {
         test.log("EXCEPTION: " + ex.getMessage());
      }

      return;
   }
   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

      this.log("__BEGIN__");

      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 + "@MindTelligent.com");
      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() + "'");

      this.log("__END__");

      return;
   }
}

3 comments:

  1. Hi,

    I have a question. Can we use OIM Client APIs directly on OIM production environment. I have a use case where we need to create users in OIM production system. Can I use OIM APIs. Any issue or impact i.e. repository corruption or do we need to restart OIM server when we use OIM APIs for user creation?

    Thanks
    Shant

    ReplyDelete
  2. Hi,

    I have a question. Can we use OIM Client APIs directly on OIM production environment. I have a use case where we need to create users in OIM production system. Can I use OIM APIs. Any issue or impact i.e. repository corruption or do we need to restart OIM server when we use OIM APIs for user creation?

    Thanks
    Shant

    ReplyDelete
  3. You may use the OIM client API to create users. But why you do that? Why don't you use the identity console to add user?

    ReplyDelete

SOA Cloud 12c GIT Repository

When a project is created, you can choose to initialize the project with one project Git repository for the project. A Maven repository is a...