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.

About the Author Mahendra

I am engulfed in Oracle Identity & Access Management domain. I have expertise on providing the optimized solutions for user provisioning, web access management, Single Sign-On and federation capabilities etc., I am also well versed with complex integrations within Identity Management and other product domains. I have expertise on building demos and implementation experience on products Oracle Access Manager, Oracle Adaptive Access Manager, Oracle Entitlement Server, Oracle Virtual Directory, Oracle Internet Directory etc., Look @ my blog: http://talkidentity.blogspot.com

Leave a Comment:

4 comments
Add Your Reply