Mar 1st, 2012, 09:54 PM
Unable to get to invalid login page
I am trying to incorporate spring security. I have it working so that depending upon the username, the users sees various menu's.
But when an incorrect login is entered, the user sees the "java.lang.IllegalArgumentException: A granted authority textual representation is required" error stacktrace.
So my retrieveUser(String username, UsernamePasswordAuthenticationToken authenticationCreds) method returns null, if the username does not exist in the database.
So how do I get a user to a custom invalid login page?
Mar 2nd, 2012, 08:05 AM
What does your stacktrace look like? The retrieveUser method looks to be custom...what does that class look like and how are you integrating it into Spring Security? If you are implementing a UserDetailsService or AuthenticationProvider, you should throw an AuthenticationException if the user is not found or has entered the incorrect password.
PS: Why do you have username and a UsernamePasswordAuthenticationToken as arguments to retrieveUser...you can obtain the username from the token.