Wildfly - FailedLoginException: Password Incorrect/Password Required Exception
I figured it out. Quite a small and silly error actually.
In my LoginService class, when it creates Logincontext I pass in name parameter as 'targin-client' whereas I should pass it as 'targin-server' which is the login module I defined for the app.
LoginContext lc = null; String username = "UseR_U"; String password = "hashedpassword"; UsernamePasswordHandler handler = new UsernamePasswordHandler(username, password == null ? null : password.toCharArray()); lc = new LoginContext("targin-client", handler); lc.login();
The correct version is:
lc = new LoginContext("targin-server", handler);
While creating a login context we pass in a security domain which points to a login module that is defined under Wildfly modules and handles authentication. Also, notice that I am using picketbox security library from Wildfly. SPLoginModule class inherits from this library.
Cheers.