Note: Before running the code make sure all the below jar files are in class path
Sample Code
import java.util.Hashtable;
import javax.security.auth.login.LoginException;
import oracle.iam.platform.OIMClient;
public class OIMTestClient
{
public static void main(String arg[])
{
Hashtable<Object, Object> env = new Hashtable<Object, Object>();
env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL, "weblogic.jndi.WLInitialContextFactory");
env.put(OIMClient.JAVA_NAMING_PROVIDER_URL, "t3://pokuri.demo.com:14000");
System.setProperty("java.security.auth.login.config", "/IdentityManagement/Blog/OIM/JDeveloperConfigforOIM/designconsole/config/authwl.conf");
System.setProperty("OIM.AppServerType", "wls");
System.setProperty("APPSERVER_TYPE", "wls");
oracle.iam.platform.OIMClient oimClient = new oracle.iam.platform.OIMClient(env);
try
{
oimClient.login("xelsysadm", "Abcd1234".toCharArray());
System.out.print("Successfully Connected with OIM ");
System.out.println("Before Lookup add--");
tcLookupOperationsIntf lookupIntf = oimClient.getService(tcLookupOperationsIntf.class);
// Create Lookup
lookupIntf.addLookupCode("UserRoles");
System.out.println("Created Lookup Table");
// Add Values to lookup
lookupIntf.addLookupValue("UserRoles", "Admin", "Admin", "en", "US");
lookupIntf.addLookupValue("UserRoles", "End-User", "End-User", "en", "US");
System.out.println("Added Lookup Values succsesfully");
}
catch (Exception e)
{
System.out.print(" Exception"+ e);
}
}
}
-- Siva Pokuri.
No comments:
Post a Comment