我尝试通过NetIq在IDAM-LDAP上验证移动用户的身份。但为此,我们需要一些服务或机制,在其中我们可以直接验证,发送我们的用户名和密码,这将由NetIq通过LDAP进行验证。
我尝试使用简单的java连接到LDAP进行用户身份验证。
使用的参数如下
INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); \n
PROVIDER_URL, "ldap:// IP ADDRESS :10389");
SECURITY_PRINCIPAL, "CN=Testnetiq.O=IBOM_test");
SECURITY_CREDENTIALS, "PASSWORD");除了我们可以用来成功测试的参数之外,我们还可以在java适配器中实现。
package com.wipro.ibm;
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");
}
}发布于 2018-04-30 20:04:33
错误javax.naming.AuthenticationNotSupportedException:[LDAP:错误代码13 -需要机密性指示您需要使用TLS/SSL连接,而不是连接到明文端口。
通常情况下,端口是636,但在本例中可能是10636,因为您的非加密端口是10389。
https://stackoverflow.com/questions/50060594
复制相似问题