2017-10-28 167 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。 ()