How to modify Bad credentials error message in spring security login?
SecurityFilterChain
public SecurityFilterChain applicationSecurityFilterChain(HttpSecurity http)
throws Exception {
http.anonymous().disable();
http.cors().and().authorizeHttpRequests().permitAll();
http
.authorizeHttpRequests(authorize -> authorize
// .requestMatchers(HttpMethod.POST, "/user/**").permitAll()
.anyRequest().authenticated())
// Form login handles the redirect to the login page from the
// authorization server filter chain
.formLogin(Customizer.withDefaults());
http.csrf().disable();
return http.build();
}
Also, added messages_en.properties files in the src/main/resource
message.badCredentials=Invalid user name and password
Still getting the same error message.
Spring boot 3.0.6