I'm making an app with Spring boot. Implement the authentication function with Spring-security.
When you press submit to perform the authentication process, the login form will transition to the page where the title error occurred. (The title error was displayed in JSON.)
Occurs when there is no permission for the URL to be transitioned in the authentication process. When authentication fails, it transitions to / login-error, but it occurred because there is no permission to access / login-error.
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests() //Authorization settings
.antMatchers("/", "/find", "/login", "/signup", "/error", "/login-error").permitAll() //All user permissions
.anyRequest().authenticated() //Access is not permitted in all other cases without authentication
.and()
.formLogin() //Login settings
.loginPage("/login")
.loginProcessingUrl("/login")
.usernameParameter("username")
.passwordParameter("password")
.failureUrl("/login-error") //URL when authentication fails
.defaultSuccessUrl("/") //Transition destination when authentication is successful
.and()
.logout() //Logout settings
.logoutRequestMatcher(new AntPathRequestMatcher("/logout**")) //Logout processing path
.logoutSuccessUrl("/") //Path when logout is completed
.permitAll();
}