Reputation: 315
As per Spring Security version 4, j_username
and j_password
are deprecated, and username
and password
should be used in JSP.
I see these variables are defined in UsernamePasswordAuthenticationFilter
.
Can we override the properties through some external configuration so that it looks for j_username
?
Upvotes: 1
Views: 504
Reputation: 6258
You can override the default parameter names this way:
@Bean
public SecurityFilterChain formLoginFilterChain(HttpSecurity http) throws Exception {
http
...
.formLogin((form) -> form
.usernameParameter("j_username")
.passwordParameter("j_password")
);
return http.build();
}
This way Spring Security will look for these parameters in the HTTP request when performing authentication.
Upvotes: 1