spring-projects / spring-projects/spring-security
InitializeUserDetailsManagerConfigurer inconsistent with UserDetailsService shared object ?
@jzheaux is already working on this.
Since Dec 18, 2020.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
Describe the bug
When a UserDetailsService bean is found by InitializeUserDetailsBeanManagerConfigurer, a DaoAuthenticationProvider is automatically add to the AuthenticationManagerBuilder but the UserDetailsService object shared by WebSecurityConfigurerAdapter doesn't delegate to the UserDetailsService bean found and throw "UserDetailsService is required." when used.
To Reproduce
Define :
- a WebSecurityConfigurerAdapter that apply a configurer that use UserDetailsService shared object
- a UserDetailsService bean (without specifying it in WebSecurityConfigurerAdapter)
Expected behavior
I think UserDetailsService shared object should take in account the UserDetailsService used by the AuthenticationManager.
More details
This behavior seems to be caused by InitializeUserDetailsBeanManagerConfigurer that use AuthenticationManagerBuilder#authenticationProvider method to add the DaoAuthenticationProvider instead of using DaoAuthenticationConfigurer.
As describe in these methods, that affect the getDefaultUserDetailsService method that is used by UserDetailsServiceDelegator.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.