Serge Iroshnikov
Serge Iroshnikov

Reputation: 919

Is Spring Data LDAP generally intended for bind authentication?

I am trying to use Spring Data LDAP for users authentication using OpenLDAP server. However, search by uid and userPassword fails because the password is stored as SSHA hashed. I wonder if really Spring Data LDAP can be used for users authentication because the tutorials usually concentrate on searching or they map password to some attribute other than userPassword.

@Entry(base = "ou=People", objectClasses = { "top", "person", "inetOrgPerson", "organizationalPerson",  "simpleSecurityObject" })
public class LdapUser {
@Id Name dn;

@Attribute(name = "userPassword")
private String password;

/** The user id. */
@Attribute(name = "uid")
private String userName;
}

public interface ILdapUserRepo extends LdapRepository<LdapUser>{
    public LdapUser findByUserNameAndPassword(String username, String password);
}

Upvotes: 0

Views: 83

Answers (1)

mp911de
mp911de

Reputation: 18129

Your use-case isn't what Spring Data LDAP is intended for. Spring Data LDAP is intended to lookup objects from LDAP by querying these and updating LDAP entities.

Performing LDAP authentication requires authentication against LDAP directly by using the appropriate connectors.

Upvotes: 1

Related Questions