How to invoke OIM from custom web application

One might want to use Oracle Identity Manager in their IDM projects for sure. Just in case if you wanted to access OIM functions at runtime in a custom web application, this post will help you.

When you are writing custom connectors in OIM, you will create a java class that has your own methods plus OIM invoking functionality. In that case, you will need to use the below code for setting OIM environment variables.

Hashtable<String, String> env=new Hashtable<String, String>();

env.put(“XL.HomeDir”, “/u01/apps/OIMPwdReset”);
env.put(“java.security.policy”,”/u01/apps/OIMPwdReset/config/xl.policy”);
env.put(“java.security.auth.login.config”,”/u01/apps/OIMPwdReset/config/auth.conf”);

You will need to package this class file into jar file and point it in OIM connector while configuring. At runtime, this class file will establish OIM connection using the OIM environment parameters XL.HomeDir, java.security.policy, java.security.auth.login.config.

However, when you have a custom web application that is residing outside the OIM server and when you want to establish OIM connectivity, the above methodology does not work. To elaborate, we have OIM server residing in OHS server (7777)  and there is a custom web application in different web server (80), then how do I invoke the OIM? If you use the above methodology, you will get an exception while creating tcUtilityFactory instance.

Here is the sample code:

System.setProperty(“XL.HomeDir”, “/u01/apps/OIMPwdReset”);
System.setProperty(“java.security.policy”, “/u01/apps/OIMPwdReset/config/xl.policy”);
System.setProperty(“java.security.auth.login.config”, “/u01/apps/OIMPwdReset/config/auth.conf”);

The OIM API Usage guide tells us to use hashtable for setting environment variables, but does not suggest to use System.setProperty. Anyhow, hope this code snippet helps people.

Comments are closed.

Scroll to Top