See https://github.com/spring-projects/spring-framework/issues/25995
Comment From: rwinch
Adding too many options to the DSL makes it just as complex as wiring things manually. I don't think it makes sense to add an option to change the AuthenticationConverter because formLogin() only knows how to process username/password (that is kind of the definition of formLogin(). If you need something more powerful, then you are doing things correctly by registering the WebFilter yourself.
Comment From: userquin
have you read my suggestion well?
Just one setter and 1 if statement, it is hard coded (I dont need spring-security add invisible recaptcha v3, just use the form login infrastructure and change just the auth manager + this server auth converter: my form is a username/password + recpatcha + action, last 2 are set by the app, no user interaction):
FormLoginSpec:
...
private ServerAuthenticationConverter serverAuthenticationConverter = new ServerFormLoginAuthenticationConverter();
...
public void FormLoginSpec serverAuthenticationConverter(ServerAuthenticationConverter serverAuthenticationConverter) {
Assert.notNull(serverAuthenticationConverter, "serverAuthenticationConverter cannot be null");
this.serverAuthenticationConverter = serverAuthenticationConverter;
return this;
}
...
protected void configure(ServerHttpSecurity http) {
...
authenticationFilter.setAuthenticationConverter(this.serverAuthenticationConverter);
...
}