本文介绍了LDAP:错误代码49-80090308:LdapErr:DSID-0C0903A9,注释:AcceptSecurityContext错误,数据52e,v1db1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道"52e"代码是当用户名有效但密码无效时.我在apache studio中使用了相同的用户名和密码,因此能够成功建立与LDAP的连接.
I know "52e" code is when username is valid, but password is invalid. I am using the same user name and password in my apache studio, I was able to establish the connection succesfully to LDAP.
这是我的Java代码
String userName = "*******";
String password = "********";
String base ="DC=PSLTESTDOMAIN,DC=LOCAL";
String dn = "cn=" + userName + "," + base;
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://******");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, dn);
env.put(Context.SECURITY_CREDENTIALS, password);
LDAPAuthenticationService ldap = new LDAPAuthenticationService();
// LdapContext ctx;
DirContext ctx = null;
try {
ctx = new InitialDirContext(env);
我的错误在这行上:ctx = new InitialDirContext(env);
我不知道是什么导致了此错误.
I do not know what exactly is causing this error.
推荐答案
数据52e-返回用户名为有效,但密码/凭据无效.
您可能需要类似
String dn = "cn=" + userName + "," + "CN=Users," + base;
这篇关于LDAP:错误代码49-80090308:LdapErr:DSID-0C0903A9,注释:AcceptSecurityContext错误,数据52e,v1db1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!