Java, LDAP: Make it not ignore blank passwords?

前端 未结 4 739
忘了有多久
忘了有多久 2020-12-14 18:37

I\'m maintaining some legacy Java LDAP code. I know next to nothing about LDAP.

The program below basically just sends the userid and password to the LDAP server,

4条回答
  •  孤街浪徒
    2020-12-14 19:06

    You need to change authentication method from simple (which is not something to use in an production environment anyways, at least not without SSL).

    As it is stated here: http://docs.oracle.com/javase/jndi/tutorial/ldap/security/simple.html

    If you supply an empty string, an empty byte/char array, or null to the Context.SECURITY_CREDENTIALS environment property, then the authentication mechanism will be "none". This is because the LDAP requires the password to be nonempty for simple authentication. The protocol automatically converts the authentication to "none" if a password is not supplied.

提交回复
热议问题