当前位置:编程学习 > JAVA >>

求救,ldap认证问题··

 Hashtable env = new Hashtable();   
     env.put(Context.PROVIDER_URL,"ldap://appserver1.mts.com:389");   
     env.put(Context.SECURITY_AUTHENTICATION, "simple");
     //env.put(Context.SECURITY_PRINCIPAL, "bbb@mts.com"); //用户名
     env.put(Context.SECURITY_PRINCIPAL, "mts\\bbb"); //用户名
    // env.put(Context.SECURITY_PRINCIPAL, "mts\\administrator"); //用户名   
     env.put(Context.SECURITY_CREDENTIALS, "p@ssword"); //密码   
     env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");   
     LdapContext ctx = new InitialLdapContext(env, null);  


上面的代码连接AD校验、很奇怪。mts\\administrator 校验可以通过,但是在同级目录下用bbb@mts.com或者mts\\bbb登陆就报异常了


javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db1
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.connect(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.<init>(Unknown Source)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(Unknown Source)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(Unknown Source)
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(Unknown Source)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(Unknown Source)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.ldap.InitialLdapContext.<init>(Unknown Source)
at Test.init(Test.java:51)
at Test.main(Test.java:135)



--------------------编程问答--------------------


大虾救命···· --------------------编程问答-------------------- 你的用户名、密码对不对 --------------------编程问答-------------------- 对的····我建了好几个用户测试,都登陆不到·
补充:Java ,  Java SE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,