Skip to content

Commit c6c34af

Browse files
committed
build/qg-xxx: исправлена конфигурация AuthenticationProvider-а PasswordEncoder-ом в тестах
Без этого SB ругался: WARN o.s.s.c.a.a.c.InitializeUserDetailsBeanManagerConfigurer$InitializeUserDetailsManagerConfigurer - Global AuthenticationManager configured with an AuthenticationProvider bean. UserDetailsService beans will not be used by Spring Security for automatically configuring username/password login. Consider removing the AuthenticationProvider bean. Alternatively, consider using the UserDetailsService in a manually instantiated DaoAuthenticationProvider. If the current configuration is intentional, to turn off this warning, increase the logging level of 'org.springframework.security.config.annotation.authentication.configuration.InitializeUserDetailsBeanManagerConfigurer' to ERROR Не связано с миграцией на SB 4
1 parent 106509d commit c6c34af

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

app/src/testFixtures/kotlin/pro/qyoga/tests/infra/test_config/spring/auth/TestPasswordEncoderConfig.kt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,17 @@ package pro.qyoga.tests.infra.test_config.spring.auth
55
import org.springframework.boot.test.context.TestConfiguration
66
import org.springframework.context.annotation.Bean
77
import org.springframework.context.annotation.Primary
8-
import org.springframework.security.authentication.dao.DaoAuthenticationProvider
9-
import org.springframework.security.core.userdetails.UserDetailsService
108
import org.springframework.security.crypto.password.NoOpPasswordEncoder
119
import org.springframework.security.crypto.password.PasswordEncoder
1210

1311

1412
@TestConfiguration
15-
class TestPasswordEncoderConfig(
16-
private val userDetailsService: UserDetailsService
17-
) {
13+
class TestPasswordEncoderConfig {
1814

1915
// Стандартный BCryptPasswordEncoder кодирует пароли по 300мс, что слишком расточительно для тестов
2016
@Suppress("DEPRECATION")
2117
@Primary
2218
@Bean
2319
fun fastPasswordEncoder(): PasswordEncoder = NoOpPasswordEncoder.getInstance()
2420

25-
@Bean
26-
fun daoAuthenticationProvider(): DaoAuthenticationProvider {
27-
val daoAuthenticationProvider = DaoAuthenticationProvider(userDetailsService)
28-
daoAuthenticationProvider.setPasswordEncoder(fastPasswordEncoder())
29-
return daoAuthenticationProvider
30-
}
31-
3221
}

0 commit comments

Comments
 (0)