I am using Spring Security OAuth2 2.0.7.RELEASE. As i am using ORM to connect to my database and default JdbcUserDetailsManager uses jdbc i wanted to implement my own UserDetail
You are using auth.jdbcAuthentication().dataSource(this.dataSource).and().userDetailsService(this.userService);// Inject custom
and I here it's creating two auth managers - one with default JdbcDaoImpl
and dataSource
pointing to this.dataSource
and another with your custom userService
. Try just putting auth.userDetailsService(this.userService)
(I hope that userService already have jdbc autowired inside).
The point here is that .and()
is used to add different authentication configurations to the authentication manager, not configuring the jdbcAuthentication()
one.