Chuyển đến nội dung chính

Registering a Plugin using OIM APIs

Version: Oracle Identity Manager 11g R2
package com.oracle.utility;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Hashtable;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.security.auth.login.LoginException;
import oracle.iam.platform.OIMClient;
import oracle.iam.platform.pluginframework.PluginException;
import oracle.iam.platformservice.api.PlatformService;
import oracle.iam.platformservice.api.PlatformUtilsService;
import oracle.iam.platformservice.exception.PlatformServiceAccessDeniedException;
/**
 * @author Pham Thanh Tung
 * Email: phamthanhtungdcn@gmail.com
 * 21-06-2017
 */
public class RegisterPlugin {
    public static final String OIM_HOSTNAME = "10.4.18.101";
    public static final String OIM_PORT = "14000";
    public static final String OIM_PROVIDER_URL = "t3://"+ OIM_HOSTNAME + ":" + OIM_PORT;
    public static final String OIM_USERNAME = "xelsysadm";
    public static final String OIM_PASSWORD = "admin";
    public static final String OIM_CLIENT_HOME = "F:/designconsole11gr3";
    public static final String AUTHWL_PATH = OIM_CLIENT_HOME + "/config/authwl.conf";
    public static final String PLUGIN_ZIP_PATH = "F:/Solution/Oracle/Idm/Connector Bundle OIM PS3/Plugin/SampleScheduledTask.zip";
 
    public static void main (String args[]) throws Exception{
        OIMClient oimClient = null;
        FileInputStream fis = null;
       
        try
        {
             //Set system properties required for OIMClient
            System.setProperty("java.security.auth.login.config", AUTHWL_PATH);
            System.setProperty("APPSERVER_TYPE", "wls");

            // Create an instance of OIMClient with OIM environment information
            Hashtable env = new Hashtable();
            env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL, "weblogic.jndi.WLInitialContextFactory");
            env.put(OIMClient.JAVA_NAMING_PROVIDER_URL, OIM_PROVIDER_URL);
            oimClient = new OIMClient(env);

            // Login to OIM with the approriate credentials
            oimClient.login(OIM_USERNAME, OIM_PASSWORD.toCharArray());
         
            // Zip file conversion to byte
            String fileName = PLUGIN_ZIP_PATH;
            File zipFile = new File(fileName);
            fis = new FileInputStream(zipFile);
            int size = (int) zipFile.length();
            byte[] b = new byte[size];
            int bytesRead = fis.read(b, 0, size);
         
            while (bytesRead < size)
            {
                bytesRead += fis.read(b, bytesRead, size - bytesRead);
            }
         
            // Register Plugin to OIM
            PlatformService service = oimClient.getService(PlatformService.class);
            service.registerPlugin(b);

            // Purge Cache
            PlatformUtilsService platUtilOps = oimClient.getService(PlatformUtilsService.class);
            platUtilOps.purgeCache("ALL");
            System.out.println("Register Done!");
        }
     
        catch (FileNotFoundException ex)
        {
            Logger.getLogger(RegisterPlugin.class.getName()).log(Level.SEVERE, null, ex);
        }
     
        catch (PlatformServiceAccessDeniedException ex)
        {
            Logger.getLogger(RegisterPlugin.class.getName()).log(Level.SEVERE, null, ex);
        }
     
        catch (PluginException ex)
        {
            Logger.getLogger(RegisterPlugin.class.getName()).log(Level.SEVERE, null, ex);
        }
     
        catch (IOException ex)
        {
            Logger.getLogger(RegisterPlugin.class.getName()).log(Level.SEVERE, null, ex);
        }
     
        catch (LoginException ex)
        {
            Logger.getLogger(RegisterPlugin.class.getName()).log(Level.SEVERE, null, ex);
        }
     
        finally
        {
            // Logout user from OIMClient
            if(oimClient != null)
            {
                oimClient.logout();
            }
            try
            {
                fis.close();                
            }
         
            catch (IOException ex)
            {
                Logger.getLogger(RegisterPlugin.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
}

Nhận xét

Bài đăng phổ biến từ blog này

Approval specific web services in Oracle IDM

Source: https://abhirockzz.wordpress.com Oracle IDM integrates with and leverages the SOA suite for approval related features (SOA is quite rich to be honest and is utilized as the back bone for Web Services connector as well). SOA is not just for namesake – SOA suite does in fact rely on the concept of loosely coupled and independent services. The approval engine makes use of three such web services Request web service : this is deployed on the OIM server Request Callback web service : this is deployed on SOA server Provisioning Callback web service : this too is deployed on OIM and used in context of approvals related to  Disconnected application instances But how/when are these (SOA) services leveraged ? Consider an example of a basic approval process OIM approval engine calls a SOA composite (from within an approval policy) in response to evaluation of a self service request.  The internals of this call are out of scope of this post (maybe some other time!) Operati

Allow Duplicate Emails

Version: Oracle Identity Manager 11.1.2.3.0 Step 1:  Login to Oracle Identity System Administration Step 2: On the navigation menu, select Configuration Properties under System Configuration. Step 3: Create the following System Property. Step 4: Verify using duplicate emails.

How to OIM cache work

Source: https://abhirockzz.wordpress.com Oracle IDM uses  OSCache  from the OpenSymphony project for  in memory caching  of objects in order to avoid repetitive calls to database and improve performance (of course !). In case you are not familiar with caching in general, I am pretty sure that as someone working on OIM, you would have executed  PurgeCache.sh  at some point in your career – so there it is ! If you have ever purged OIM’s cache, you have indirectly used OSCache.. yay ! How is it implemented ? OIM uses a facade/wrapper over the core OSCache caching APIs XLCacheProvider  is essentially used as the generic interface which is implemented by a class called  OSCacheProvider  (this is OIM specific). You should be able to see an entry of this class in  oim-config.xml  (caching categories config section). It’s FQDN is  oracle.iam.platform.utils.cache.OSCacheProvider This class implements the contract put forth in the XLCacheProvider interface and leverages internal OSCache A