Expected Behavior FormLoginConfigurer could have a method to call AbstractAuthenticationConvigurer#setAuthenticationFilter(). UsernamePasswordAuthenticationFilter would become the default filter if we don't call the setter

Current Behavior Now there is no way to redefine the filter without crutches. The use of UsernamePasswordAuthenticationFilter is hardcoded although AbstractAuthenticationConvigurer has a setter method. Spring Security Customize filter instance with HttpSecurity#formLogin call

Spring Security Customize filter instance with HttpSecurity#formLogin call

Context

Comment From: jzheaux

Thank you for the suggestion, @arthursalimkhanov.

You can replace a filter by doing:

http.addFilter(new MyCustomUsernamePasswordAuthenticationFilter());

Or if needed, you can still use the formLogin() DSL and then post-process the filter using an object post-processor.

Comment From: 9arth

Thank you for the suggestion, @arthursalimkhanov.

You can replace a filter by doing:

java http.addFilter(new MyCustomUsernamePasswordAuthenticationFilter());

Or if needed, you can still use the formLogin() DSL and then post-process the filter using an object post-processor.

this is not at all what you suggest. 'Or if needed, you can still use the formLogin() DSL and then post-process the filter using an object post-processor.' - Why such difficulties if you can just add the ability to select this filter during configuration? I have a feeling that you are rejecting the request without understanding the problem.

Comment From: 9arth

PR Here is the PR that solves the problem. And it seems I'm not the only one who stumbled upon this bug, which does not allow configuring without problems.

Comment From: quaff

PR Here is the PR that solves the problem. And it seems I'm not the only one who stumbled upon this bug, which does not allow configuring without problems.

It's incredible we both stumbled at the same time.

Comment From: 9arth

PR Here is the PR that solves the problem. And it seems I'm not the only one who stumbled upon this bug, which does not allow configuring without problems.

It's incredible we both stumbled at the same time.

It seems to me that this is such an obvious point that why no one has fixed it so far.

Comment From: jzheaux

I have a feeling that you are rejecting the request without understanding the problem.

I'm sorry you are feeling that way, let's keep working on this. Does this comment address what you are trying to do?

Comment From: 9arth

comment No, it adds a new filter instead of replacing the old one, it does not have the old filter settings that were added at the time of configuration. The implementation made in this PR will work for me. Thanks for reviewing my issue.