LDAP: error code 49 - Simple Bind Failed: NT_STATUS_LOGON_FAILURE

社会主义新天地 提交于 2019-12-05 19:52:36

You are using a relative distinguished name which will not work.

Change your code to use

env.put(Context.SECURITY_PRINCIPAL, "cn=userName,cn=Users,dc=organisation,dc=in");

and also change your search context to:

private static final String NAMED_CONTEXT = "CN=Users,dc=organisation,dc=in";

Always use full distinguished names with LDAP.

Amyuni Devteam

We were having the same issue in our code and we fixed it by adding the domain name before the user name. Instead of entering user:password, enter domain\user:password.

Hope this helps.

To do an LDAP bind you will need to use one of the a Unique return for one of the Ambiguous Name Resolution entries. Normally, one would use the Fully Distinguished name.

We have a JNDI Example showing how this could be done.

-jim

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!