javax.naming.InvalidNameException: [LDAP: error code 34 - invalid DN]

前端 未结 2 643
别跟我提以往
别跟我提以往 2021-01-19 04:58

I\'m a college student. Now, i\'m doing a project that must use LDAP connection to authenticate the username and password of the user in log in process. So, my website is de

2条回答
  •  爱一瞬间的悲伤
    2021-01-19 05:39

    This is the important line: javax.naming.InvalidNameException: [LDAP: error code 34 - invalid DN]

    You can look here: https://wiki.servicenow.com/index.php?title=LDAP_Error_Codes

    for what 34 means, but it looks like the distinguished name you are trying to use is incorrect. It looks like your principal could be formatted incorrectly. See this guide from oracle on doing ldap authentication: http://docs.oracle.com/javase/jndi/tutorial/ldap/security/ldap.html

    pay special attention to this part of it where they set up the environment entries:

    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    env.put(Context.SECURITY_PRINCIPAL, "cn=S. User, ou=NewHires, o=JNDITutorial");
    env.put(Context.SECURITY_CREDENTIALS, "mysecret");
    

提交回复
热议问题