【发布时间】:2016-10-03 09:26:16
【问题描述】:
我需要连接到 LDAP 服务器,但出现以下错误:
javax.naming.AuthenticationException:[LDAP:错误代码 49 - 80090308:LdapErr:DSID-0C090334,注释:AcceptSecurityContext 错误,数据 525,vece
用户名和密码正确,我尝试设置相同的用户并传入另一个用 .NET 编写的应用程序,它在那里工作,但在 Java 中我收到错误消息。
我的代码是:
@RequestMapping(方法 = RequestMethod.GET) public ModelAndView 登录(ModelMap 模型){
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://subdomain.domain.com:389");
env.put(Context.SECURITY_PRINCIPAL, "uid=username,DC=subdomain,DC=domain,DC=com");
env.put(Context.SECURITY_CREDENTIALS, "password");
InitialDirContext context;
try
{
context = new InitialDirContext(env);
}
catch (NamingException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
我会请有工作代码的人在这里发布。
谢谢!!
【问题讨论】:
标签: spring authentication ldap