LPS-30569 - import user from LDAP only when necessary

Hi Juan,

I've implemented this change for one customer, to prevent unnecessary LDAP imports during user's repetitive logins. This change improved the throughput of login attempts during our load tests.

Maybe it would be valuable to consider it for core as well.

Josef