-
Notifications
You must be signed in to change notification settings - Fork 6k
Security raise StackOverflowError using authenticationManagerBuilder when user have wrong credentials #11609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the report @darkman97i, this might be a duplicate of #11088. It should be confirmed as soon as someone from the team picks this up to analyze. |
Any new about this matter? Will be possible share some documentation link or sample where be shown how to register serveral authentication providers. Using a XML definition file it works without problems I share here a sample:
But doing the same in code it is a headache, can please indicate some documentation or sample what really explain how doing the same with code. Thanks for your time. |
You can expose the @Bean
AuthenticationManager apiAuthenticationManager(InMemoryUserDetailsManager users, JdbcUserDetailsManager jdbcUsers) {
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
provider.setUserDetailsService(users);
DaoAuthenticationProvider jdbcProvider = new DaoAuthenticationProvider();
jdbcProvider.setUserDetailsService(jdbcUsers);
return new ProviderManager(provider, jdbcProvider);
} |
@marcusdacoregio Thanks a lot for your time. I will test. |
@marcusdacoregio Sorry for my late reply. It worked perfectly, thanks for your help. In the spring-boot issue, I have written a full sample based in your recommendations spring-projects/spring-boot#31836 For me you can close the issue. |
** Versions **
I have previously added an issue at spring-projects/spring-boot#31836 and they redirect to possible spring-security bug or wrong configuration with the authenticationManagerBuilder
Describe the bug
I'm moving from old authentication style to the new authentication style based on the article published in the blog spring-security-without-the-websecurityconfigureradapter -> before adding the issue I have looking in stackoverflow for similar issue, here in closed issues, dead loops etc... but I have not been able to find anything in the same direction.
Everythings goes fine, except when I introduce bad credentials, then the application seems go into a loop until it is raised an java.lang.StackOverflowError: null ( here the full error stack trace error.txt)
To Reproduce
I have created a sample code at https://github.com/darkman97i/spring-security-test ( in the sample I'm using two providers inmemory and jdbc. Also I included h2 database with user credentials into for a quick test ).
Thanks for your time
The text was updated successfully, but these errors were encountered: