Реализация NETIQ IDAM LDAP с использованием JAVA - PullRequest
0 голосов
/ 28 апреля 2018

Мы пытаемся интегрировать аутентификацию LDPA с использованием технологии Java, но не можем подключиться к серверу IDAM-NETIQ, используя нижеприведенный код,

подробности параметра,

    INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    PROVIDER_URL, "ldap:// IP ADDRESS :10389");
    SECURITY_PRINCIPAL, "CN=Testnetiq.O=IBOM_test");
    SECURITY_CREDENTIALS, "PASSWORD");

package com.test.poc;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.directory.InitialDirContext;
import javax.naming.directory.SearchControls;

public class Testing {

    public static void main(String[] args) throws Exception {
    Properties props = new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    props.put(Context.PROVIDER_URL, "ldap:// ldap ip :10389");
    props.put(Context.SECURITY_PRINCIPAL, "CN=Testnetiq.O=IBOM_test");
    props.put(Context.SECURITY_CREDENTIALS, "Wipro@123");

    InitialDirContext context = new InitialDirContext(props);

    SearchControls ctrls = new SearchControls();
    ctrls.setReturningAttributes(new String[] { "givenName", "sn", "memberOf" });
    ctrls.setSearchScope(SearchControls.SUBTREE_SCOPE);

    NamingEnumeration<javax.naming.directory.SearchResult> answers = context.search("o=IBOM_test",
            "(uid=" + "Test123" + ")", ctrls);
    javax.naming.directory.SearchResult result = answers.nextElement();
    String user = result.getNameInNamespace();

    try {
        props = new Properties();
        props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
        props.put(Context.PROVIDER_URL, "ldap://ldap ip :10389");
        props.put(Context.SECURITY_PRINCIPAL, user);
        props.put(Context.SECURITY_CREDENTIALS, "Test@123");

        context = new InitialDirContext(props);
        } catch (Exception e) {
            System.out.println("false");
        }
        System.out.println("True");
    }

}

при доступе мы получаем ошибку, как показано ниже,

err] javax.naming.AuthenticationNotSupportedException: [LDAP: ошибка код 13 - Требуется конфиденциальность] [err] в com.sun.jndi.ldap.LdapCtx.mapErrorCode (LdapCtx.java:3127) [err] в com.sun.jndi.ldap.LdapCtx.processReturnCode (LdapCtx.java:3082) [err]
в com.sun.jndi.ldap.LdapCtx.processReturnCode (LdapCtx.java:2883) [err] на com.sun.jndi.ldap.LdapCtx.connect (LdapCtx.java:2797) [err] в com.sun.jndi.ldap.LdapCtx. (LdapCtx.java:319) [ошибаться] в com.sun.jndi.ldap.LdapCtxFactory.getUsingURL (LdapCtxFactory.java:192) [ошибаться] в com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs (LdapCtxFactory.java:210) [ошибаться] в com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance (LdapCtxFactory.java:153) [ошибаться] в com.sun.jndi.ldap.LdapCtxFactory.getInitialContext (LdapCtxFactory.java:83) [ошибаться] в org.apache.aries.jndi.ContextHelper.getInitialContextUsingBuilder (ContextHelper.java:244) [err] в [внутренние классы] [err] в javax.naming.spi.NamingManager.getInitialContext (NamingManager.java:684) [ошибаться] в javax.naming.InitialContext.getDefaultInitCtx (InitialContext.java:313) [err] at javax.naming.InitialContext.init (InitialContext.java:244)

В чем проблема с нашим Java-кодом или сервером LDAP?

1 Ответ

0 голосов
/ 30 апреля 2018

Трассировка стека указывает, что вашему серверу LDAP требуется TLS / SSL (LDAP: код ошибки 13 - требуется конфиденциальность).

Попробуйте подключиться к порту LDAPS.

Обычно это 636.

В вашем случае, поскольку вы пытаетесь подключиться к порту 10389, это может быть 10636.

Вам, вероятно, потребуется импортировать сертификат Organizational CA в хранилище ключей Java, чтобы успешно подключиться.

Это инструкции по экспорту сертификата с использованием iManager.

Чтобы экспортировать самозаверяющий сертификат ЦС организации:

Launch iManager.

Log in to the eDirectory tree as an administrator with the appropriate rights.

To view the appropriate rights for this task, see Entry Rights Needed to Perform Tasks.

On the Roles and Tasks menu, click NetIQ Certificate Server > Configure Certificate Authority.

This brings up the property pages for the Organizational CA, which include a General page, a CRL page, a Certificates page, and other eDirectory-related pages.

Click Certificates, then select the self-signed certificate.

Click Export and follow the prompts to export the certificate.

This starts the Certificate Export Wizard. Ensure the Export private key check box is not selected (does not have a check mark).

Click Finish.

Вы можете найти эту информацию здесь: https://www.netiq.com/documentation/edirectory-91/edir_admin/data/b1j4tpo3.html#b1j4tu55

...