I have a Spring Boot application that has spring security configured using WebSecurityConfigurerAdapter. The problem I'm having is at .failureUrl. If I define it like this
failureUrl("/login?error")
and in my page if the error is present a message is shown. The login form is at the bottom of the page and I want the user to remain there when he is redirected via the failureUrl. So, I changed the url to
"/login?error#id"
where id is the id of the error message div. If I do this, the user is redirected to
/login#id
the ?error part is omitted completely. What am I doing wrong? Are there special characters that need to be escaped in the WebSecurityConfigurerAdapter?
Later edit:
I found the problem: I needed to add "/login" in the permitAll antmatchers.