When your application is using keycloak to authenticate to Microsoft Active Directory LDAP service, You may receive the error “keycloak.models.ModelException: User returned from LDAP has null username!” in the logs and the login fails.
You may want to look at this article (https://edwin.baculsoft.com/2019/10/fixing-error-null-username-when-integrating-redhat-single-sign-on-to-active-directory for configuration and initial troubleshooting.
There are so many reasons for that, and you probably searched a lot and tried many of it already before you reach this page.
So, here is one more thing for you to try:
Set proper naming values for the account you’re testing with.
Yes, I know, it is silly indeed; but it’s true. The account must have First and Last names, as well as display name properly configured.
HTH some1