How to authenticate user via OIM API?

戏子无情 提交于 2019-12-07 12:24:04

问题


I need to do oim user authentication from third party application. I am searching for OIM API for the same.


回答1:


In OIM the authentication is offloaded to the Application server (i.e. WebLogic) hence you will have to add a Authentication Provider which knows how to connect to the application which you want OIM to use for authentication.

https://blogs.oracle.com/ArdaEralp/entry/configure_oim_ad_ldap_authentication https://docs.oracle.com/cd/E28280_01/web.1111/e13718/atn.htm#DEVSP220

The above links will provide a view into how you can configure a new Autentication provider for OIM and what an Authentication Provider actually means and its internals.




回答2:


public static final String OIM_HOSTNAME = "oim.hpt.lab";
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 = "tungpt";
public static final String OIM_PASSWORD = "Hpt123456";
public static final String OIM_CLIENT_HOME = "F:/designconsole11gr3/config";
public static final String AUTHWL_PATH = OIM_CLIENT_HOME + "/authwl.conf";

public static void main(String[] args) {
    // TODO Auto-generated method stub
    OIMClient oimClient = 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
        System.out.println("Login by: "+ OIM_USERNAME);
        oimClient.login(OIM_USERNAME, OIM_PASSWORD.toCharArray());
        System.out.println("Login Done!");
    }catch(Exception e){
        e.printStackTrace();
    }
}


来源:https://stackoverflow.com/questions/38245525/how-to-authenticate-user-via-oim-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!