|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2019 the original author or authors. |
| 2 | + * Copyright 2012-2021 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
31 | 31 | import org.springframework.context.annotation.Configuration;
|
32 | 32 | import org.springframework.context.annotation.Import;
|
33 | 33 | import org.springframework.security.authentication.AuthenticationManager;
|
| 34 | +import org.springframework.security.authentication.AuthenticationManagerResolver; |
34 | 35 | import org.springframework.security.authentication.AuthenticationProvider;
|
35 | 36 | import org.springframework.security.authentication.ProviderManager;
|
36 | 37 | import org.springframework.security.authentication.TestingAuthenticationProvider;
|
@@ -83,6 +84,12 @@ void defaultUserNotCreatedIfAuthenticationManagerBeanPresent(CapturedOutput outp
|
83 | 84 | });
|
84 | 85 | }
|
85 | 86 |
|
| 87 | + @Test |
| 88 | + void defaultUserNotCreatedIfAuthenticationManagerResolverBeanPresent(CapturedOutput output) { |
| 89 | + this.contextRunner.withUserConfiguration(TestAuthenticationManagerResolverConfiguration.class) |
| 90 | + .run((context) -> assertThat(output).doesNotContain("Using generated security password: ")); |
| 91 | + } |
| 92 | + |
86 | 93 | @Test
|
87 | 94 | void defaultUserNotCreatedIfUserDetailsServiceBeanPresent(CapturedOutput output) {
|
88 | 95 | this.contextRunner.withUserConfiguration(TestUserDetailsServiceConfiguration.class).run((context) -> {
|
@@ -266,4 +273,14 @@ protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
266 | 273 |
|
267 | 274 | }
|
268 | 275 |
|
| 276 | + @Configuration(proxyBeanMethods = false) |
| 277 | + static class TestAuthenticationManagerResolverConfiguration { |
| 278 | + |
| 279 | + @Bean |
| 280 | + AuthenticationManagerResolver<?> authenticationManagerResolver() { |
| 281 | + return mock(AuthenticationManagerResolver.class); |
| 282 | + } |
| 283 | + |
| 284 | + } |
| 285 | + |
269 | 286 | }
|
0 commit comments