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

前端 未结 2 636
别跟我提以往
别跟我提以往 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");
    
    0 讨论(0)
  • 2021-01-19 05:58

    The "javax.naming.InvalidNameException: [LDAP: error code 34 - invalid DN] " in your stack trace is the key. Your LDAP server doesn't like the value you are sending it. I would suggest fully qualifying the user name, something like cn=username, ou=some_container, o=mycompany. The actual syntax will be driven by your LDAP server.

    0 讨论(0)
提交回复
热议问题