scottvevans
Aug 26th, 2004, 05:03 PM
Our client wants to display on the login form whether the authentication failed due to unknown username or invalid password. I've looked at DaoAuthenticationProvider and discovered that in the getUserFromBackend private method, the code catches any UsernameNotFoundException thrown by the AuthenticationDao, and throws in its place a BadCredentialsException.
Could we develop a means for the client layer to tell the difference between failures due to invalid username or invalid password. We've thrown around some ideas here:
* Add a BadPrincipalException to match the BadCredentialsException
* Add a flag to BadCredentialsException indicating username or password
* Stop catching the UsernameNotFoundException - it is a subclass of AuthenticationException
* Wrap the UsernameNotFoundException inside the BadCredentialsException
We also experimented with using the listener for the events, but didn't find a clean way to communicate the event to a jsp.
Thanks.
Could we develop a means for the client layer to tell the difference between failures due to invalid username or invalid password. We've thrown around some ideas here:
* Add a BadPrincipalException to match the BadCredentialsException
* Add a flag to BadCredentialsException indicating username or password
* Stop catching the UsernameNotFoundException - it is a subclass of AuthenticationException
* Wrap the UsernameNotFoundException inside the BadCredentialsException
We also experimented with using the listener for the events, but didn't find a clean way to communicate the event to a jsp.
Thanks.