Я пытаюсь использовать 2 провайдера аутентификации с Spring Boot, используя Kotlin:
Этот метод находится в классе:
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
@Import(SecurityProblemSupport::class)
class SecurityConfiguration(
...
) : WebSecurityConfigurerAdapter() {
@Throws(Exception::class)
override fun configure(auth: AuthenticationManagerBuilder) {
//super.configure(auth); DON'T DO THIS - for sure...
val dap = DaoAuthenticationProvider()
dap.setUserDetailsService(domanUserDetailsService)
auth.authenticationProvider(LegacyUserDaoAuthenticationProvider(legacyUserService)) .
auth.authenticationProvider(dap)
// Breakpoint here shows that both authentication providers are in the builder
}
...
}
Когда я запускаю отладчик после запуска приложения, ProviderManager
имеет только 1 провайдера. Почему-то AuthenticationManagerBuilder
не использует 2 authenticationProvider
с, которые были добавлены здесь. Я проверил, что мой метод configure
вызывается и что AuthenticationManagerBuilder
имеет 2 провайдера аутентификации после этого метода.
Что-то происходит с установкой, которую я сделал здесь (или Spring не используетAuthenticationManagerBuilder
, который я настроил.
Кто-нибудь знает почему?