env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://xxx.xxx.xxx.xx:xxx");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "CN=username");
env.put(Context.SECURITY_CREDENTIALS, pwd);
env.put(Context.REFERRAL,"follow");
我只需要搜索特定域中的“CN”。尝试使用上述方式和多种格式,但最终出现错误“LDAP 错误代码 49 AcceptSecurityContext 错误数据 52e v2580”。请有人帮我解决这个问题。
最佳答案
不确定我们在您的问题陈述中遗漏了什么。
LDAP 错误代码 49 AcceptSecurityContext 错误数据 52e 当用户名有效但密码/凭据无效时返回。
我们有几个 JNDI Against Microsoft Active Directory 的示例.
您应该告诉我们您尝试过什么并显示日志或结果并阅读: https://stackoverflow.com/help/how-to-ask
关于java - 使用 "com.sun.jndi.ldap.LdapCtxFactory"的 LDAP 身份验证中 SECURITY_PRINCIPAL 的正确格式是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59606804/