Polish
This commit is contained in:
parent
37bef961ea
commit
e1602fe59a
|
|
@ -574,7 +574,6 @@ public class EndpointWebMvcAutoConfigurationTests {
|
||||||
"server.ssl.enabled=true", "server.ssl.key-store=classpath:test.jks",
|
"server.ssl.enabled=true", "server.ssl.key-store=classpath:test.jks",
|
||||||
"server.ssl.key-password=password", "management.ssl.enabled=false")
|
"server.ssl.key-password=password", "management.ssl.enabled=false")
|
||||||
.applyTo(this.applicationContext);
|
.applyTo(this.applicationContext);
|
||||||
|
|
||||||
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
|
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
|
||||||
DifferentPortConfig.class, BaseConfiguration.class,
|
DifferentPortConfig.class, BaseConfiguration.class,
|
||||||
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
|
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
|
||||||
|
|
|
||||||
|
|
@ -293,13 +293,10 @@ public class SecurityAutoConfigurationTests {
|
||||||
public void testDefaultUsernamePassword() throws Exception {
|
public void testDefaultUsernamePassword() throws Exception {
|
||||||
this.context = new AnnotationConfigWebApplicationContext();
|
this.context = new AnnotationConfigWebApplicationContext();
|
||||||
this.context.setServletContext(new MockServletContext());
|
this.context.setServletContext(new MockServletContext());
|
||||||
|
|
||||||
this.context.register(SecurityAutoConfiguration.class);
|
this.context.register(SecurityAutoConfiguration.class);
|
||||||
this.context.refresh();
|
this.context.refresh();
|
||||||
|
|
||||||
SecurityProperties security = this.context.getBean(SecurityProperties.class);
|
SecurityProperties security = this.context.getBean(SecurityProperties.class);
|
||||||
AuthenticationManager manager = this.context.getBean(AuthenticationManager.class);
|
AuthenticationManager manager = this.context.getBean(AuthenticationManager.class);
|
||||||
|
|
||||||
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(
|
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(
|
||||||
security.getUser().getName(), security.getUser().getPassword());
|
security.getUser().getName(), security.getUser().getPassword());
|
||||||
assertThat(manager.authenticate(token)).isNotNull();
|
assertThat(manager.authenticate(token)).isNotNull();
|
||||||
|
|
@ -310,14 +307,11 @@ public class SecurityAutoConfigurationTests {
|
||||||
throws Exception {
|
throws Exception {
|
||||||
this.context = new AnnotationConfigWebApplicationContext();
|
this.context = new AnnotationConfigWebApplicationContext();
|
||||||
this.context.setServletContext(new MockServletContext());
|
this.context.setServletContext(new MockServletContext());
|
||||||
|
|
||||||
this.context.register(AuthenticationManagerCustomizer.class,
|
this.context.register(AuthenticationManagerCustomizer.class,
|
||||||
SecurityAutoConfiguration.class);
|
SecurityAutoConfiguration.class);
|
||||||
this.context.refresh();
|
this.context.refresh();
|
||||||
|
|
||||||
SecurityProperties security = this.context.getBean(SecurityProperties.class);
|
SecurityProperties security = this.context.getBean(SecurityProperties.class);
|
||||||
AuthenticationManager manager = this.context.getBean(AuthenticationManager.class);
|
AuthenticationManager manager = this.context.getBean(AuthenticationManager.class);
|
||||||
|
|
||||||
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(
|
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(
|
||||||
security.getUser().getName(), security.getUser().getPassword());
|
security.getUser().getName(), security.getUser().getPassword());
|
||||||
try {
|
try {
|
||||||
|
|
@ -327,7 +321,6 @@ public class SecurityAutoConfigurationTests {
|
||||||
catch (AuthenticationException success) {
|
catch (AuthenticationException success) {
|
||||||
// Expected
|
// Expected
|
||||||
}
|
}
|
||||||
|
|
||||||
token = new UsernamePasswordAuthenticationToken("foo", "bar");
|
token = new UsernamePasswordAuthenticationToken("foo", "bar");
|
||||||
assertThat(manager.authenticate(token)).isNotNull();
|
assertThat(manager.authenticate(token)).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue