2017-10-28 178 views
0

我正嘗試連接到Oracle ADF中的外部weblogic嵌入式LDAP。 我剛剛找到一個使用JpsContextFactory類的很好的示例代碼,它沒有得到任何url,用戶名和密碼。它似乎通過defult連接到本地weblogic ldap。我無法弄清楚如何使用此類設置與外部weblogic ldap的連接。使用JpsContextFactory的外部LDAP連接

示例代碼:

private void initIdStoreFactory() { 
    JpsContextFactory ctxFactory; 
    try { 
     ctxFactory = JpsContextFactory.getContextFactory(); 
     JpsContext ctx = ctxFactory.getContext(); 
     LdapIdentityStore idStoreService = (LdapIdentityStore) ctx.getServiceInstance(IdentityStoreService.class); 

     ldapFactory = idStoreService.getIdmFactory(); 

     storeEnv.put(OIDIdentityStoreFactory.RT_USER_SEARCH_BASES, USER_BASES); 
     storeEnv.put(OIDIdentityStoreFactory.RT_GROUP_SEARCH_BASES, GROUP_BASES); 
     storeEnv.put(OIDIdentityStoreFactory.RT_USER_CREATE_BASES, USER_BASES); 
     storeEnv.put(OIDIdentityStoreFactory.RT_GROUP_CREATE_BASES, GROUP_BASES); 
     storeEnv.put(OIDIdentityStoreFactory.RT_GROUP_SELECTED_CREATE_BASE, GROUP_BASES[0]); 
     storeEnv.put(OIDIdentityStoreFactory.RT_USER_SELECTED_CREATE_BASE, USER_BASES[0]); 
    } catch (JpsException e) { 
     e.printStackTrace(); 
     throw new RuntimeException("Jps Exception encountered", e); 
    } 
} 

任何建議如何使用此代碼連接到外部LDAP將不勝感激。

回答

0

JpsContextFactory用於檢索weblogic內身份存儲的當前信息。爲了將它與外部LDAP一起使用,您需要首先在Weblogic中添加一個新的安全提供程序,並根據需要聲明它,以便您的應用程序使用新的外部LDAP。 ()