I successfully implemented my custom external user storage provider that lets users login with username and password by following the instructions in User storage SPI. To this end, I implemented the getUserByUsername method from the UserLookupProvider interface and verified that it gets called when a user attempts login, returning the user.
Now I need to allow users to login with their registered email as well. I activated Login with email in realm settings for the realm. What I was expecting was getUserByEmail to be called at some point during the login process. Instead, only getUserByUsername is called with the e-mail address and fails to return the user, since it’s not searching in the email field of my external storage.
Am I wrong in my assumption that getUserByEmail would be called? Should I implement getUserByUsername so that it looks for both username and email? Thanks.