为外部ladp连接ADF项目配置jps-config.xml

时间:2017-10-29 10:55:37

标签: java oracle ldap weblogic oracle-adf

我正在尝试连接到Oracle ADF中的外部weblogic嵌入式LDAP。我刚刚找到了一个使用JpsContextFactory类的好示例代码,它没有获取任何url,用户名和密码。它适用于本地weblogic ldap。在搜索源代码后,我发现有jps-config.xml文件配置与ldap的连接。我想知道如何配置此文件以连接到外部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);
}

}

1 个答案:

答案 0 :(得分:0)

ADF将身份验证委派给WebLogic安全层 - 因此您应该在运行ADF应用程序的WebLogic中设置到LDAP存储库的映射。 https://docs.oracle.com/middleware/12213/wls/SECMG/providers.htm#SECMG131