Skip to main content

Posts

Showing posts with the label OIM API

Create User through SCIM-REST OIM PS3

Below are the Parameters to create a user in OIM through REST: URL: http://OIM_HOST:14000/idaas/im/scim/v1/Users Authentication:  Username(xelsysadm): Password Request Type: Post Request Content: Application/scim+json Request Body: { "schemas": [ "urn:ietf:params:scim:schemas:extension:oracle:2.0:OIG:User", "urn:ietf:params:scim:schemas:core:2.0:User", "urn:ietf:params:scim:schemas:extension:oracle:2.0:IDM:User", "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User" ], "userName": "USER_LOGIN", "password":"PASSWORD", "name": { "givenName": "FIRST_NAME", "familyName": "LAST_NAME" }, "emails": [ { "value": "EMAIL", "type": "work" } ], "userType": "Full-Time", "urn:ietf:params:scim:schemas:extension:enterprise:2...

OIM Connection and Create User API - 11g R2 PS3

For Setting up OIM API Environment on local desktop download any IDE like Eclipse and create a Java Project. Connect to the OIM Environment and download all the libs from OIM Server as below: <Oracle_IDM_Home>/designconsole/ext <Oracle_IDM_Home>/designconsole/lib <MW_home>/oracle_common/modules/oracle.jrf_11.1.1/jrf-api.jar <MW_home>/wlserver_10.3/server/lib/wlfullclient.jar Attach all these jars in the Java Build Path of the project. Then write a connection code to OIM. Sample code is as below: package com.oracle.oim; import java.util.Hashtable; import javax.security.auth.login.LoginException; import oracle.iam.platform.OIMClient; public class Connection  { public OIMClient OimConnection()    { oracle.iam.platform.OIMClient oimClient = null; try  {        Hashtable<Object, Object> env = new Hashtable<Object, Object>();       ...

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 or...

Account Provisioning through API - OIM 11g R2

public class AccountManagement { OIMClient client=ClientOIM.initialise(); oracle.iam.provisioning.api.ApplicationInstanceService appInstanceService=client.getService(oracle.iam.provisioning.api.ApplicationInstanceService.class); ProvisioningService provisioningService=client.getService(ProvisioningService.class); ClientOIM oim=new ClientOIM(); public void provisionAccount(String accName,String userID) { try { if (accName!=null && !accName.equals("") && userID!=null && !userID.equals("") ) { ApplicationInstance appInstance=appInstanceService.findApplicationInstanceByName(accName); long appKey=appInstance.getApplicationInstanceKey(); System.out.println("AppKey is "+appKey); FormInfo formInfo=appInstance.getAccountForm(); String formKey=String.valueOf(formInfo.getFormKey()); System.out.println("formKey is "+formKey); HashMap parentData=new HashMap(); /*Madator...

Searching and creating Organization Through API- OIM 11g R2

public class OrgManagement { static OrganizationManager orgManager=null; static OIMClient client=null; static Organization organization=null; public static void createOrg(String orgName, String orgType) { try { client=ClientOIM.initialise(); if (orgName!=null && orgType!=null) { orgManager=client.getService(OrganizationManager.class); System.out.println("OrgManagement :: createOrg :: org is "+orgManager); HashMap<String, Object> mapAttrs = new HashMap<String, Object>(); mapAttrs.put(OrganizationManagerConstants.AttributeName.ORG_NAME.getId(),orgName); mapAttrs.put(OrganizationManagerConstants.AttributeName.ORG_TYPE.getId(),orgType); Organization org=new Organization(null,mapAttrs); orgManager.create(org); System.out.println("OrgManagement :: createOrg ::  Organization created"); } }  catch (OrganizationManagerException e) { // TODO Auto-generated catch block e.printStackTrace(); ...

Creating Role through OIM API - 11gR2

package com.oim.utilities; import java.util.HashMap; import oracle.iam.identity.rolemgmt.api.RoleManager; import oracle.iam.identity.rolemgmt.api.RoleManagerConstants; import oracle.iam.identity.rolemgmt.vo.Role; import oracle.iam.platform.OIMClient; public class RoleManagement  { static RoleManager roleManager=null; static OIMClient client=null; @SuppressWarnings("null") public static void createRole(String roleName){ System.out.println("RoleManagement :: createRole :: role name is "+roleName); try  { if (roleName!=null) { HashMap<String, Object> mapAttrs = new HashMap<String, Object>();; mapAttrs.put(RoleManagerConstants.ROLE_NAME, roleName); mapAttrs.put(RoleManagerConstants.ROLE_DISPLAY_NAME,roleName); mapAttrs.put(RoleManagerConstants.ROLE_DESCRIPTION, roleName); Role role = new Role(mapAttrs); // Initialising the OIM Connection client=ClientOIM.initialise(); System.out.println("RoleManagemen...

OIM connection with API- 11g R2

package com.oim.utilities; import java.util.HashSet; import java.util.Hashtable; import java.util.Set; import Thor.API.tcUtilityFactory; import oracle.iam.identity.exception.NoSuchUserException; import oracle.iam.identity.exception.SearchKeyNotUniqueException; import oracle.iam.identity.exception.UserLookupException; import oracle.iam.identity.usermgmt.api.UserManager; import oracle.iam.identity.usermgmt.vo.User; import oracle.iam.platform.OIMClient; public class ClientOIM { private static OIMClient oimClient = null;     private static tcUtilityFactory util = null;     static UserManager userManager = null;     private static String hostName = "oim.server.com";     private static String port = "14000";     private static String userName = "xelsysadm";     private static String password = "Welcome123";     private static String serverURL = "t3://" + hostName + ":" + port;     private ...

Fetching User Attributes and Creating User - OIM API

package com.oim.utilities; import java.util.HashSet; import java.util.Hashtable; import java.util.Set; import Thor.API.tcUtilityFactory; import oracle.iam.identity.exception.NoSuchUserException; import oracle.iam.identity.exception.SearchKeyNotUniqueException; import oracle.iam.identity.exception.UserLookupException; import oracle.iam.identity.usermgmt.api.UserManager; import oracle.iam.identity.usermgmt.vo.User; import oracle.iam.platform.OIMClient; public class ClientOIM { private static OIMClient oimClient = null;     private static tcUtilityFactory util = null;     static UserManager userManager = null;     private static String hostName = "oim.server.com";     private static String port = "14000";     private static String userName = "xelsysadm";     private static String password = "Welcome123";     private static String serverURL = "t3://" + hostName + ":" + port;     private ...

Developing an Event Handler with OIM 11g R2

The process of any Oracle Identity Manager operation that goes through a predefined set of stages and executes some business logic in each stage is called an orchestration. An event handler is a piece of code that is registered with an orchestration on various stages. These event handlers are invoked when the relevant orchestration stage is performed. The supported orchestration stages in which a custom event handler can be registered are validation, preprocess, and postprocess. Code will extend PostProcessHandler, PreprocessHandler  or ValidationHandler based on the kind of Event Handler desired. Code Snippet:- public EventResult execute(long processId, long eventId, Orchestration orchestration) { HashMap<String, Serializable> parameters = orchestration .getParameters(); String company = getParamaterValue(parameters, "Company"); if ((company == null) || company.equals("")) { company = “ABC” orchestration.addParameter("Company...