-
Notifications
You must be signed in to change notification settings - Fork 6k
Fix Infinite recursion WebSecurityConfigurerAdapter.java #11071
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
Conversation
Fixed Infinite recursion issue during authenticate and loadUserByUsername method execution.
@Milan-Toliya Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@Milan-Toliya Thank you for signing the Contributor License Agreement! |
Hi @Milan-Toliya, thanks for contributing to Spring Security. Have you opened an issue before working on the code changes? Can you help me understand what this PR fixes and what is the use case? |
Hi @marcusdacoregio I did not open an issue before submitting this patch. With respect to Use case, I was trying to implement security filter in the web app. I Implemented WebSecurityConfigurerAdapter and used InMemoryUserDetailsManager to store user details. I did Implemented WebSecurityConfigurerAdapter twice in the same project. It was causing issue in boot up, I fixed that by adding I have eliminated Infinite recursion by throwing an Exception when I may have missed important details to share here as I'm new to the spring community. Please Let me know if more details required. |
Thanks @Milan-Toliya. Are you able to create a minimal, reproducible example so I can simulate your scenario here? There are many constraints in your use case that I'd like to verify before moving on with the PR. It'd also be great if you could open an issue and add the example and all other details there. |
Hi, @marcusdacoregio I have opened an issue for this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Milan-Toliya, while we cannot simulate the root problem that is happening, this was brought to the team's attention and we think that your changes make sense since it's "cheaper" to throw an IllegalStateException
than waiting for the StackOverflowError
to happen.
If users have configured things in an unsupported way, throwing an IllegalStateException
feels like an improvement from an error handling perspective.
Did you try adding any tests?
...ringframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.java
Outdated
Show resolved
Hide resolved
...ringframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.java
Outdated
Show resolved
Hide resolved
…ation/web/configuration/WebSecurityConfigurerAdapter.java Co-authored-by: Marcus Hert Da Coregio <[email protected]>
…ation/web/configuration/WebSecurityConfigurerAdapter.java Co-authored-by: Marcus Hert Da Coregio <[email protected]>
Corrected message
Closing in favor of #12343 |
Fixed Infinite recursion issue during authenticate and loadUserByUsername method execution.