LDAP Password re-check

Hi,
I’m trying re-check the user authentication, I’m connect to Ldap and i need to confirm the user identity before some important actions in my application I already try PasswordEncryption methods but i figured out that only work with cuba internal authentication. Exist any similar method to test Ldap Password.

Regards,
João Gomes

Hi,

Take a look at com.haulmont.cuba.web.security.ldap.LdapLoginProvider class. It uses LdapTemplate from Spring LDAP.

You can use the same method to check your password in LDAP:

    protected boolean authenticateInLdap(LoginPasswordCredentials credentials) throws LoginException {
        String login = credentials.getLogin();
        String password = credentials.getPassword();

        return ldapTemplate.authenticate(LdapUtils.emptyLdapName(), buildPersonFilter(login), password);
    }

Hi,
Many thanks for your help.
Using your indication and more information about Spring LDAP i’m able to write a class to do the Job.

Regards.
João Gomes